elvish/eval/builtin_ns.go

26 lines
555 B
Go
Raw Normal View History

package eval
import (
"strconv"
"syscall"
2018-01-01 23:21:15 +08:00
2018-02-15 16:59:49 +08:00
"github.com/elves/elvish/eval/vars"
"github.com/xiaq/persistent/vector"
)
2018-02-07 03:39:40 +08:00
var builtinNs = Ns{
2018-02-15 16:59:49 +08:00
"_": vars.NewBlackhole(),
2018-11-18 22:23:31 +08:00
"pid": vars.NewReadOnly(strconv.Itoa(syscall.Getpid())),
"ok": vars.NewReadOnly(OK),
"nil": vars.NewReadOnly(nil),
2018-11-18 22:23:31 +08:00
"true": vars.NewReadOnly(true),
"false": vars.NewReadOnly(false),
2018-02-07 03:39:40 +08:00
"paths": &EnvList{envName: "PATH"},
"pwd": PwdVariable{},
2018-11-18 22:23:31 +08:00
"args": vars.NewReadOnly(vector.Empty),
}
2017-06-28 07:39:05 +08:00
2018-02-07 03:39:40 +08:00
func addBuiltinFns(fns map[string]interface{}) {
2019-04-19 05:57:14 +08:00
builtinNs.AddGoFns("", fns)
}