1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 16:58:06 +08:00

tce add hook

This commit is contained in:
shaoying 2018-11-09 22:05:45 +08:00
parent f5ad8da0a5
commit 49317a3e5c
7 changed files with 22 additions and 6 deletions

View File

@ -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

View File

@ -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])
"}}}

View File

@ -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
}

8
etc/exit.shy Normal file
View File

@ -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

View File

@ -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"))

View File

@ -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")

View File

@ -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"},