This commit is contained in:
Liang Ding 2022-06-13 16:27:34 +08:00
parent 596ea7689a
commit c269c10442
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
3 changed files with 17 additions and 2 deletions

View file

@ -89,7 +89,7 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/restic/chunker v0.4.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/siyuan-note/dejavu v0.0.0-20220612144647-aab04039e33b // indirect
github.com/siyuan-note/dejavu v0.0.0-20220613081907-2b6372ecfa83 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect

View file

@ -427,6 +427,8 @@ github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJV
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/siyuan-note/dejavu v0.0.0-20220612144647-aab04039e33b h1:HQLzy92vLOMy6MR2t1/oEW7LRfKMD2TljMYwwue2i5Q=
github.com/siyuan-note/dejavu v0.0.0-20220612144647-aab04039e33b/go.mod h1:pZFVF2imlfZMT5w6899ZwXCLKVccZ9GDJzdLHJ+ONik=
github.com/siyuan-note/dejavu v0.0.0-20220613081907-2b6372ecfa83 h1:ZeBtsvGLIr8Wd9nkIpGoJ2FIzfVZXHAGHWvXWLsvwQU=
github.com/siyuan-note/dejavu v0.0.0-20220613081907-2b6372ecfa83/go.mod h1:pZFVF2imlfZMT5w6899ZwXCLKVccZ9GDJzdLHJ+ONik=
github.com/siyuan-note/encryption v0.0.0-20210811062758-4d08f2d31e37 h1:WvJU9uRS7kaaqnNShIMMtR2Yf8duGmXYJXYGg69EXBs=
github.com/siyuan-note/encryption v0.0.0-20210811062758-4d08f2d31e37/go.mod h1:hWBdT3FZEzWvIbZpXYJvkSBH2+Z4GvYcOpKpXcZC+zg=
github.com/siyuan-note/encryption v0.0.0-20220609141541-7ba697278320 h1:CQKC+OpTjzFJjZK9/NY3OYg/gSYmMQM9RsBk5Mznimg=

View file

@ -50,6 +50,18 @@ func InitRepoKey() (err error) {
return
}
var indexCallbacks = map[string]dejavu.Callback{
"walkData": func(context, arg interface{}, err error) {
context.(func(msg string))(arg.(string))
},
"getLatestFile": func(context, arg interface{}, err error) {
context.(func(msg string))(arg.(string))
},
"upsertFile": func(context, arg interface{}, err error) {
context.(func(msg string))(arg.(string))
},
}
func IndexRepo(message string) (err error) {
if 1 > len(Conf.Repo.Key) {
err = errors.New("repo key is nil")
@ -61,6 +73,7 @@ func IndexRepo(message string) (err error) {
return
}
_, err = repo.Index(message)
_, err = repo.Index(message, util.PushEndlessProgress, indexCallbacks)
util.PushClearProgress()
return
}