mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-26 01:04:06 +08:00
tce add ctx.scan_path
This commit is contained in:
parent
a3885ec58d
commit
fb76f5016c
@ -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
|
||||
|
@ -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
|
||||
|
@ -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"]
|
||||
|
@ -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])
|
||||
|
Loading…
x
Reference in New Issue
Block a user