elvish/eval/builtin_ns.go

25 lines
497 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(),
"pid": vars.NewRo(strconv.Itoa(syscall.Getpid())),
"ok": vars.NewRo(OK),
"true": vars.NewRo(true),
"false": vars.NewRo(false),
2018-02-07 03:39:40 +08:00
"paths": &EnvList{envName: "PATH"},
"pwd": PwdVariable{},
"args": vars.NewRo(vector.Empty),
}
2017-06-28 07:39:05 +08:00
2018-02-07 03:39:40 +08:00
func addBuiltinFns(fns map[string]interface{}) {
builtinNs.AddBuiltinFns("", fns)
}