mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-13 18:07:51 +08:00
a3f4384495
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.
26 lines
577 B
Go
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)
|
|
},
|
|
}))
|
|
}
|