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(),
|
2018-11-18 22:23:31 +08:00
|
|
|
"pid": vars.NewReadOnly(strconv.Itoa(syscall.Getpid())),
|
|
|
|
"ok": vars.NewReadOnly(OK),
|
2019-04-08 05:49:28 +08:00
|
|
|
"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),
|
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{}) {
|
2019-04-19 05:57:14 +08:00
|
|
|
builtinNs.AddGoFns("", fns)
|
2018-02-04 12:25:23 +08:00
|
|
|
}
|