diff --git a/Makefile b/Makefile index 4b4c5b29..88ef8f5a 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ install: @go get github.com/gomarkdown/markdown go install $(BENCH) @date + bench web.code.counter nmake 1 install_all: install touch etc/local.shy diff --git a/etc/dotsfile/.vimrc b/etc/dotsfile/.vimrc index 49e5bdf6..743a2136 100644 --- a/etc/dotsfile/.vimrc +++ b/etc/dotsfile/.vimrc @@ -178,6 +178,6 @@ function! BenchCode(cmd, arg) exe "silent !bench web.code." . a:cmd . " " . join(a:arg, " ") endfunction -" autocmd BufReadPost * call BenchCode("counter", ["nopen", 1]) +autocmd BufReadPost * call BenchCode("counter", ["nopen", 1]) autocmd BufWritePost * call BenchCode("counter", ["nsave", 1]) "}}} diff --git a/etc/dotsfile/.zshrc b/etc/dotsfile/.zshrc index 6ed573ac..0c9ac3ae 100644 --- a/etc/dotsfile/.zshrc +++ b/etc/dotsfile/.zshrc @@ -107,6 +107,6 @@ bindkey -M vicmd j down-line-or-beginning-search bindkey -M vicmd k up-line-or-beginning-search preexec() { - bench web.code.counter nexec 1 + bench web.code.counter nexec 1 >/dev/null } diff --git a/etc/exit.shy b/etc/exit.shy new file mode 100644 index 00000000..91b85580 --- /dev/null +++ b/etc/exit.shy @@ -0,0 +1,8 @@ +source etc/exit_local.shy + +~code + config save var/counter.json counter +~stdio + config save var/history.json history +return hello + diff --git a/src/contexts/cli/cli.go b/src/contexts/cli/cli.go index 2451447c..ebbb7bea 100644 --- a/src/contexts/cli/cli.go +++ b/src/contexts/cli/cli.go @@ -883,7 +883,7 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心", m.Append("objects", mem.HeapObjects) m.Table() }}, - "develop": &ctx.Command{Name: "develop", Help: "develop", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) { + "windows": &ctx.Command{Name: "windows", Help: "windows", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) { m.Append("nclient", strings.Count(m.Spawn().Cmd("system", "tmux", "list-clients").Result(0), "\n")) m.Append("nsession", strings.Count(m.Spawn().Cmd("system", "tmux", "list-sessions").Result(0), "\n")) m.Append("nwindow", strings.Count(m.Spawn().Cmd("system", "tmux", "list-windows", "-a").Result(0), "\n")) diff --git a/src/contexts/nfs/nfs.go b/src/contexts/nfs/nfs.go index 79538efe..f184470a 100644 --- a/src/contexts/nfs/nfs.go +++ b/src/contexts/nfs/nfs.go @@ -1366,6 +1366,13 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心", args = append(args, arg[1:]...) } + switch c { + case "commit": + m.Find("web.code").Cmd("counter", "ncommit", 1) + case "push": + m.Find("web.code").Cmd("counter", "npush", 1) + } + m.Log("info", "cmd: %s %v", "git", ctx.Trans("-C", p, c, args)) msg := m.Sess("cli").Cmd("system", "git", "-C", p, c, args) m.Copy(msg, "result").Copy(msg, "append") diff --git a/src/examples/code/code.go b/src/examples/code/code.go index bfd015e9..956550b9 100644 --- a/src/examples/code/code.go +++ b/src/examples/code/code.go @@ -55,15 +55,15 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心", "pre_run": true, "display_result": "", }, - map[string]interface{}{"name": "develop", "help": "develop", "template": "componet", - "context": "cli", "command": "develop", + map[string]interface{}{"name": "windows", "help": "windows", "template": "componet", + "context": "cli", "command": "windows", "inputs": []interface{}{ map[string]interface{}{"type": "button", "label": "refresh"}, }, "pre_run": true, "display_result": "", }, - map[string]interface{}{"name": "counter", "help": "counter", "template": "componet", + map[string]interface{}{"name": "develop", "help": "develop", "template": "componet", "context": "web.code", "command": "config", "arguments": []interface{}{"counter"}, "inputs": []interface{}{ map[string]interface{}{"type": "button", "label": "refresh"},