diff --git a/Makefile b/Makefile index e7bf42e2..ac52e646 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ BENCH=src/extend/bench.go -upgrade=usr/upgrade/ +publish=usr/publish/ install: @go get github.com/nsf/termbox-go @@ -51,17 +51,17 @@ tar_all: tar linux64 darwin win64 tar zcvf tar.tgz tar linux_arm: - GOARCH=arm GOOS=linux go build -o $(upgrade)bench.linux.arm $(BENCH) + GOARCH=arm GOOS=linux go build -o $(publish)bench.linux.arm $(BENCH) linux32: - GOARCH=386 GOOS=linux go build -o $(upgrade)bench.linux.386 $(BENCH) + GOARCH=386 GOOS=linux go build -o $(publish)bench.linux.386 $(BENCH) linux64: - GOARCH=amd64 GOOS=linux go build -o $(upgrade)bench.linux.amd64 $(BENCH) + GOARCH=amd64 GOOS=linux go build -o $(publish)bench.linux.amd64 $(BENCH) darwin: - GOARCH=amd64 GOOS=darwin go build -o $(upgrade)bench.darwin.amd64 $(BENCH) + GOARCH=amd64 GOOS=darwin go build -o $(publish)bench.darwin.amd64 $(BENCH) win32: - GOARCH=386 GOOS=windows go build -o $(upgrade)bench.win32.exe $(BENCH) + GOARCH=386 GOOS=windows go build -o $(publish)bench.win32.exe $(BENCH) win64: - GOARCH=amd64 GOOS=windows go build -o $(upgrade)bench.win64.exe $(BENCH) + GOARCH=amd64 GOOS=windows go build -o $(publish)bench.win64.exe $(BENCH) DOTS=etc/dotsfile diff --git a/src/contexts/cli/cli.go b/src/contexts/cli/cli.go index bf713887..7f34f5c4 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": 3, "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) { // 管道参数 @@ -625,7 +625,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:] @@ -707,8 +709,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 @@ -775,6 +777,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") @@ -870,7 +876,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")+string(os.PathListSeparator)+os.Getenv("GOPATH"), + "cmd_env", "GOPATH", m.Conf("runtime", "boot.ctx_home") + string(os.PathListSeparator) + os.Getenv("GOPATH"), "cmd_env", "PATH", os.Getenv("PATH"), } diff --git a/src/contexts/cli/version.go b/src/contexts/cli/version.go index 5e7d084c..8ad4c8e8 100644 --- a/src/contexts/cli/version.go +++ b/src/contexts/cli/version.go @@ -4,5 +4,5 @@ var version = struct { host string self int }{ - "2019-09-10 18:45:48", "centos", 508, + "2019-09-10 21:10:24", "centos", 509, } diff --git a/src/contexts/tcp/tcp.go b/src/contexts/tcp/tcp.go index d5f820eb..752852da 100644 --- a/src/contexts/tcp/tcp.go +++ b/src/contexts/tcp/tcp.go @@ -29,7 +29,7 @@ func (tcp *TCP) parse(m *ctx.Message, arg ...string) ([]string, []string, bool) address := []string{} if arg[1] == "dev" { - m.Cmd("web.get", arg[1], arg[2], "temp", "ports", "format", "object").Table(func(line map[string]string) { + m.Cmd("web.get", arg[1], arg[2], "temp", "ports", "format", "object", "temp_expire", "10").Table(func(line map[string]string) { address = append(address, line["value"]) }) if len(address) == 0 { diff --git a/src/plugin/context/index.shy b/src/plugin/context/index.shy index 44cd43d7..1bc82c91 100644 --- a/src/plugin/context/index.shy +++ b/src/plugin/context/index.shy @@ -30,7 +30,8 @@ kit missyou "任务" private \ kit pod "设备" private "ssh._route" _ "ssh.remote" __ \ text "" name pod view long \ button "行动" action auto \ - exports pod pod + button "返回" click Back \ + exports pod pod pod kit ctx "模块" private "ssh._route" _ context _ list __ \ text "" name pod imports plugin_pod action auto view long \ diff --git a/src/plugin/favor/index.shy b/src/plugin/favor/index.shy index 08775e92..bff7a5c9 100644 --- a/src/plugin/favor/index.shy +++ b/src/plugin/favor/index.shy @@ -14,7 +14,8 @@ kit macro "脚本宏" "macro.js" public \ button "运行" click "Replay" \ exports mac name -kit sys "命令行" public "nfs.source" \ +kit sys "命令行" public "ssh._route" _ "nfs.source" \ + text "" name pod imports plugin_pod \ textarea "" view long \ button "运行" \ exports mac name diff --git a/usr/librarys/example.js b/usr/librarys/example.js index 6c0a06de..9264e305 100644 --- a/usr/librarys/example.js +++ b/usr/librarys/example.js @@ -699,6 +699,7 @@ function Plugin(page, pane, field, runs) { var inputs = JSON.parse(meta.inputs || "[]") var display = JSON.parse(meta.display||'{}') var feature = JSON.parse(meta.feature||'{}') + var display = JSON.parse(meta.display||'{}') var exports = JSON.parse(meta.exports||'["",""]') var deal = (feature && feature.display) || "table" var history = [] @@ -713,7 +714,7 @@ function Plugin(page, pane, field, runs) { }: cb) }) - var count = kit.Selector(option, "args").length + var count = kit.Selector(option, ".args").length args && count < args.length && (item.value = value||args[count++]||item.value||""); (item.title || item.name) && (item.title = item.title || item.name) @@ -727,6 +728,7 @@ function Plugin(page, pane, field, runs) { input.type = "select", input.list = item.values.map(function(value) { return {type: "option", value: value, inner: value} }) + input.value = item.value break case "textarea": input.type = "textarea", item.style = "height:100px;"+"width:"+(pane.target.clientWidth-30)+"px" @@ -902,10 +904,7 @@ function Plugin(page, pane, field, runs) { return name == "status" || line.status == "stop" ? undefined: line.you }, pod: function(value, name, line) { - if (option[exports[0]].value) { - return option[exports[0]].value+"."+line.pod - } - return line.pod + return (option[exports[0]].value? option[exports[0]].value+".": "")+line.pod }, dir: function(value, name, line) { name != "path" && (value = line.path)