mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-12 17:27:50 +08:00
9112eb1ab2
Instead of having each individual module embed their .elv files and collect all of them in pkg/mods/doc, have a single embed.FS at pkg that includes everything, and use that pkg/mods/doc. Implement a function that extracts all module elvdocs, and put it in pkg/elvdoc.
27 lines
727 B
Go
27 lines
727 B
Go
package eval
|
|
|
|
import (
|
|
"strconv"
|
|
"syscall"
|
|
|
|
"src.elv.sh/pkg/buildinfo"
|
|
"src.elv.sh/pkg/eval/vars"
|
|
)
|
|
|
|
var builtinNs = BuildNsNamed("").AddVars(map[string]vars.Var{
|
|
"_": vars.NewBlackhole(),
|
|
"pid": vars.NewReadOnly(strconv.Itoa(syscall.Getpid())),
|
|
"ok": vars.NewReadOnly(OK),
|
|
"nil": vars.NewReadOnly(nil),
|
|
"true": vars.NewReadOnly(true),
|
|
"false": vars.NewReadOnly(false),
|
|
"buildinfo": vars.NewReadOnly(buildinfo.Value),
|
|
"version": vars.NewReadOnly(buildinfo.Value.Version),
|
|
"paths": vars.NewEnvListVar("PATH"),
|
|
"nop" + FnSuffix: vars.NewReadOnly(nopGoFn),
|
|
})
|
|
|
|
func addBuiltinFns(fns map[string]any) {
|
|
builtinNs.AddGoFns(fns)
|
|
}
|