From 412631a028766665098a8f31419d97f5ed0ab594 Mon Sep 17 00:00:00 2001 From: shaoying Date: Sun, 8 Sep 2019 08:57:02 +0800 Subject: [PATCH] fix code lost --- src/contexts/cli/cli.go | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/contexts/cli/cli.go b/src/contexts/cli/cli.go index 5bf6d620..996e2589 100644 --- a/src/contexts/cli/cli.go +++ b/src/contexts/cli/cli.go @@ -121,10 +121,10 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心", }, Help: "源码编译"}, "publish": &ctx.Config{Name: "publish", Value: map[string]interface{}{ "path": "usr/publish", "list": map[string]interface{}{ - "boot_sh": "bin/boot.sh", - "zone_sh": "bin/zone.sh", - "user_sh": "bin/user.sh", - "node_sh": "bin/node.sh", + "boot_sh": "bin/boot.sh", + "zone_sh": "bin/zone.sh", + "user_sh": "bin/user.sh", + "node_sh": "bin/node.sh", "init_shy": "etc/init.shy", "common_shy": "etc/common.shy", @@ -145,10 +145,10 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心", "list": map[string]interface{}{ "bench": "bin/bench.new", - "boot_sh": "bin/boot.sh", - "zone_sh": "bin/zone.sh", - "user_sh": "bin/user.sh", - "node_sh": "bin/node.sh", + "boot_sh": "bin/boot.sh", + "zone_sh": "bin/zone.sh", + "user_sh": "bin/user.sh", + "node_sh": "bin/node.sh", "init_shy": "etc/init.shy", "common_shy": "etc/common.shy", @@ -248,7 +248,7 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心", "cmd_temp": -1, "cmd_parse": 2, "cmd_error": 0, - "cmd_select": -1, + "cmd_select": -1, "app_log": 1, }, Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) { // 管道参数 @@ -624,7 +624,9 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心", format := kit.Select(m.Conf("time", "format"), m.Option("time_format")) t, stamp := time.Now(), true if len(arg) > 0 { - if i, e := strconv.ParseInt(arg[0], 10, 64); e == nil { + if arg[0] == "show" { + stamp = false + } else if i, e := strconv.ParseInt(arg[0], 10, 64); e == nil { t, stamp, arg = time.Unix(int64(i/int64(m.Confi("time", "unit"))), 0), false, arg[1:] } else if n, e := time.ParseInLocation(format, arg[0], time.Local); e == nil { t, arg = n, arg[1:] @@ -706,8 +708,8 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心", return }}, "proc": &ctx.Command{Name: "proc", Help: "进程管理", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) { - m.Cmdy("cli.system", "cmd_parse", "cut", "ps", kit.Select("ax", arg, 0)) - if len(arg) > 0 { + m.Cmdy("cli.system", "ps", kit.Select("ax", arg, 0), "cmd_parse", "cut") + if len(arg) > 1 { m.Cmd("select", "reg", "COMMAND", arg[1]) } return @@ -774,6 +776,10 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心", }) m.Cmdp(0, []string{"go build"}, []string{"cli.system", "go", "get"}, list) + case "stats": + // 代码统计 + m.Cmdy("nfs.dir", kit.Select("src", arg, 1), "dir_deep", "dir_type", "file", "dir_sort", "line", "int_r", "dir_select", "group", "") + case "stat": // 代码统计 m.Cmdy("nfs.dir", "src", "dir_deep", "dir_type", "file", "dir_sort", "line", "int_r") @@ -869,7 +875,7 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心", env := []string{ "cmd_env", "GOOS", goos, "cmd_env", "GOARCH", arch, "cmd_env", "GOTMPDIR", tmp, "cmd_env", "GOCACHE", tmp, - "cmd_env", "GOPATH", m.Conf("runtime", "boot.ctx_home")+":"+os.Getenv("GOPATH"), + "cmd_env", "GOPATH", m.Conf("runtime", "boot.ctx_home") + ":" + os.Getenv("GOPATH"), "cmd_env", "PATH", os.Getenv("PATH"), }