forked from x/ContextOS
tce what
This commit is contained in:
parent
5302004d03
commit
4b2d693011
@ -640,6 +640,13 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
||||
}
|
||||
}},
|
||||
"run": &ctx.Command{Name: "run", Help: "脚本参数", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
name := path.Join(m.Option("dir_root"), m.Option("download_dir"))
|
||||
msg := m.Sess("nfs").Add("option", "dir_reg", ".*\\.(sh|shy|py)$").Add("option", "dir_root", "").Cmd("dir", name)
|
||||
m.Copy(msg, "append").Copy(msg, "result")
|
||||
return
|
||||
}
|
||||
|
||||
name := path.Join(m.Option("dir_root"), m.Option("download_dir"), arg[0])
|
||||
msg := m.Spawn(c).Cmd("cmd", name, arg[1:])
|
||||
m.Copy(msg, "append").Copy(msg, "result")
|
||||
|
@ -2560,6 +2560,7 @@ var Index = &Context{Name: "ctx", Help: "模块中心",
|
||||
for _, k := range msg.Meta["option"] {
|
||||
if len(arg) == 0 {
|
||||
m.Add("append", "key", k)
|
||||
m.Add("append", "len", len(msg.Meta[k]))
|
||||
m.Add("append", "value", fmt.Sprintf("%v", msg.Meta[k]))
|
||||
continue
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user