You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zk/internal/adapter/lsp/cmd_index.go

28 lines
633 B
Go

package lsp
import (
"fmt"
"github.com/zk-org/zk/internal/core"
)
const cmdIndex = "zk.index"
func executeCommandIndex(notebook *core.Notebook, args []interface{}) (interface{}, error) {
opts := core.NoteIndexOpts{}
if len(args) == 2 {
options, ok := args[1].(map[string]interface{})
if !ok {
return nil, fmt.Errorf("zk.index expects a dictionary of options as second argument, got: %v", args[1])
}
if forceOption, ok := options["force"]; ok {
opts.Force = toBool(forceOption)
}
if verboseOption, ok := options["verbose"]; ok {
opts.Verbose = toBool(verboseOption)
}
}
return notebook.Index(opts)
}