elvish/pkg/edit/command_api.go
Qi Xiao a3f4384495 Move all elvdocs into .d.elv files.
The elvdocs still use the old format (#elvdoc:fn or #elvdoc:var) for now, but
will be changed to "fn" and "var" forms soon.

Also remove the accidentally committed cmd/mvelvdoc. It has been used to perform
the conversion automatically but is not supposed to be committed.
2022-11-20 21:59:45 +00:00

26 lines
577 B
Go

package edit
// Implementation of the editor "command" mode.
import (
"src.elv.sh/pkg/cli/modes"
"src.elv.sh/pkg/eval"
)
func initCommandAPI(ed *Editor, ev *eval.Evaler, nb eval.NsBuilder) {
bindingVar := newBindingVar(emptyBindingsMap)
bindings := newMapBindings(ed, ev, bindingVar)
nb.AddNs("command",
eval.BuildNsNamed("edit:command").
AddVar("binding", bindingVar).
AddGoFns(map[string]any{
"start": func() {
w := modes.NewStub(modes.StubSpec{
Bindings: bindings,
Name: " COMMAND ",
})
ed.app.PushAddon(w)
},
}))
}