From 4b2d6930110f574b918c2bcb2e5951ba1d73ec3c Mon Sep 17 00:00:00 2001 From: shaoying Date: Sat, 24 Nov 2018 09:43:10 +0800 Subject: [PATCH] tce what --- src/contexts/cli/cli.go | 7 +++++++ src/contexts/ctx/ctx.go | 1 + 2 files changed, 8 insertions(+) diff --git a/src/contexts/cli/cli.go b/src/contexts/cli/cli.go index ecfee7e9..7b252c42 100644 --- a/src/contexts/cli/cli.go +++ b/src/contexts/cli/cli.go @@ -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") diff --git a/src/contexts/ctx/ctx.go b/src/contexts/ctx/ctx.go index a15c5136..4920105d 100644 --- a/src/contexts/ctx/ctx.go +++ b/src/contexts/ctx/ctx.go @@ -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 }