2016-02-28 06:43:54 +08:00
|
|
|
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"
|
2018-09-29 03:08:32 +08:00
|
|
|
"github.com/xiaq/persistent/vector"
|
2016-02-28 06:43:54 +08:00
|
|
|
)
|
|
|
|
|
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{},
|
2018-09-29 03:08:32 +08:00
|
|
|
"args": vars.NewRo(vector.Empty),
|
2016-02-28 06:43:54 +08:00
|
|
|
}
|
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)
|
2018-02-04 12:25:23 +08:00
|
|
|
}
|