diff --git a/etc/init.shy b/etc/init.shy index 1a4bac29..7f83251e 100644 --- a/etc/init.shy +++ b/etc/init.shy @@ -1,6 +1,6 @@ -source etc/demo.shy -return source etc/local.shy +~file1 history load etc/history.txt +return return "hello" "world" source etc/demo.shy diff --git a/src/contexts/cli/cli.go b/src/contexts/cli/cli.go index 43c7cb4b..3c77bb27 100644 --- a/src/contexts/cli/cli.go +++ b/src/contexts/cli/cli.go @@ -208,7 +208,7 @@ func (cli *CLI) Start(m *ctx.Message, arg ...string) bool { // {{{ m.Cap("stream", yac.Target().Name) if arg[1] == "stdio" { - msg := m.Spawn().Cmd("source", "etc/init.shy") + msg := m.Spawn().Cmd("source", m.Conf("init.shy")) msg.Result(0, msg.Meta["return"]) } return false diff --git a/src/contexts/ctx.go b/src/contexts/ctx.go index 91089ace..ea5e9b6a 100644 --- a/src/contexts/ctx.go +++ b/src/contexts/ctx.go @@ -1931,6 +1931,8 @@ var Index = &Context{Name: "ctx", Help: "模块中心", "nmessage": &Cache{Name: "消息数量", Value: "0", Help: "显示模块启动时所创建消息的数量"}, }, Configs: map[string]*Config{ + "scan_path": &Config{Name: "调试模式(true/false)", Value: "", Help: "是否打印错误信息,off:不打印,on:打印)"}, + "debug": &Config{Name: "调试模式(true/false)", Value: "true", Help: "是否打印错误信息,off:不打印,on:打印)"}, "default": &Config{Name: "默认的搜索起点(root/back/home)", Value: "root", Help: "模块搜索的默认起点,root:从根模块,back:从父模块,home:从当前模块"}, "start": &Config{Name: "启动模块", Value: "cli", Help: "启动时自动运行的模块"}, @@ -2992,17 +2994,25 @@ func init() { } func Start(args ...string) { + if len(args) > 0 { + Pulse.Conf("scan_path", args[0]) + args = args[1:] + } if len(args) > 0 { Pulse.Conf("init.shy", args[0]) + args = args[1:] } - if len(args) > 1 { - Pulse.Conf("bench.log", args[1]) + if len(args) > 0 { + Pulse.Conf("bench.log", args[0]) + args = args[1:] } - if len(args) > 2 { - Pulse.Conf("root", args[2]) + if len(args) > 0 { + Pulse.Conf("root", args[0]) + args = args[1:] } - if len(args) > 3 { - Pulse.Conf("start", args[3]) + if len(args) > 0 { + Pulse.Conf("start", args[0]) + args = args[1:] } Index.Owner = Index.contexts["aaa"] diff --git a/src/contexts/nfs/nfs.go b/src/contexts/nfs/nfs.go index f452f9be..d12b0205 100644 --- a/src/contexts/nfs/nfs.go +++ b/src/contexts/nfs/nfs.go @@ -823,8 +823,14 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心", if arg[0] == "stdio" { m.Optionv("in", os.Stdin) m.Optionv("out", os.Stdout) - } else if f, e := os.Open(arg[0]); m.Assert(e) { - m.Optionv("in", f) + } else { + p := arg[0] + if !path.IsAbs(arg[0]) { + p = path.Join(m.Conf("scan_path"), arg[0]) + } + if f, e := os.Open(p); m.Assert(e) { + m.Optionv("in", f) + } } m.Start(m.Confx("nfs_name", arg, 1), m.Confx("nfs_help", arg, 2), key, arg[0])