mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-05 03:17:50 +08:00
5e6954dbf3
This fixes #1432.
33 lines
861 B
Go
33 lines
861 B
Go
package eval
|
|
|
|
import (
|
|
"embed"
|
|
"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)
|
|
}
|
|
|
|
// BuiltinDElvFiles embeds all the .d.elv files for the builtin module.
|
|
//
|
|
//go:embed *.d.elv
|
|
var BuiltinDElvFiles embed.FS
|