mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-26 01:04:06 +08:00
add commit.hook
This commit is contained in:
parent
d22cf113a6
commit
8deb3d47a0
@ -1,4 +1,7 @@
|
||||
source etc/local.shy
|
||||
|
||||
~stdio
|
||||
config load var/history.json history
|
||||
~code
|
||||
config load var/counter.json counter
|
||||
|
||||
source etc/local.shy
|
||||
|
||||
|
@ -885,13 +885,13 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
||||
}},
|
||||
"develop": &ctx.Command{Name: "develop", Help: "develop", 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("nsesion", strings.Count(m.Spawn().Cmd("system", "tmux", "list-sessions").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"))
|
||||
m.Append("npane", strings.Count(m.Spawn().Cmd("system", "tmux", "list-panes", "-a").Result(0), "\n"))
|
||||
|
||||
m.Append("ncommand", strings.Count(m.Spawn().Cmd("system", "tmux", "list-commands").Result(0), "\n"))
|
||||
m.Append("nbuf", strings.Count(m.Spawn().Cmd("system", "tmux", "list-buffers").Result(0), "\n"))
|
||||
m.Append("ncmd", strings.Count(m.Spawn().Cmd("system", "tmux", "list-commands").Result(0), "\n"))
|
||||
m.Append("nkey", strings.Count(m.Spawn().Cmd("system", "tmux", "list-keys").Result(0), "\n"))
|
||||
m.Append("nbuffer", strings.Count(m.Spawn().Cmd("system", "tmux", "list-buffers").Result(0), "\n"))
|
||||
m.Table()
|
||||
}},
|
||||
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"syscall"
|
||||
"time"
|
||||
"toolkit"
|
||||
)
|
||||
|
||||
|
@ -3371,12 +3371,15 @@ func Start(args ...string) {
|
||||
}
|
||||
|
||||
if len(args) > 0 {
|
||||
Pulse.Options("log", false)
|
||||
|
||||
cmd := Pulse.Sess("cli", false).Cmd("source", args)
|
||||
for _, v := range cmd.Meta["result"] {
|
||||
fmt.Printf("%v", v)
|
||||
}
|
||||
} else {
|
||||
Pulse.Options("log", true)
|
||||
|
||||
log := Pulse.Sess("log", false)
|
||||
log.target.Start(log)
|
||||
|
||||
|
@ -182,7 +182,11 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
|
||||
return
|
||||
}
|
||||
|
||||
table := m.Confv("tables", arg[0]).(string)
|
||||
table := arg[0]
|
||||
switch v := m.Confv("tables", arg[0]).(type) {
|
||||
case string:
|
||||
table = v
|
||||
}
|
||||
|
||||
msg := m.Spawn().Cmd("query", fmt.Sprintf("desc %s", table))
|
||||
m.Copy(msg, "append")
|
||||
|
@ -13,6 +13,7 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
||||
"counter": &ctx.Config{Name: "counter", Value: map[string]interface{}{
|
||||
"nopen": "0", "nsave": "0",
|
||||
}, Help: "counter"},
|
||||
"counter_service": &ctx.Config{Name: "counter_service", Value: "http://localhost:9094/code/counter", Help: "counter"},
|
||||
"web_site": &ctx.Config{Name: "web_site", Value: []interface{}{
|
||||
map[string]interface{}{"_name": "MDN", "site": "https://developer.mozilla.org"},
|
||||
map[string]interface{}{"_name": "github", "site": "https://github.com"},
|
||||
@ -62,7 +63,7 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
||||
"pre_run": true,
|
||||
"display_result": "",
|
||||
},
|
||||
map[string]interface{}{"name": "develop", "help": "develop", "template": "componet",
|
||||
map[string]interface{}{"name": "counter", "help": "counter", "template": "componet",
|
||||
"context": "web.code", "command": "config", "arguments": []interface{}{"counter"},
|
||||
"inputs": []interface{}{
|
||||
map[string]interface{}{"type": "button", "label": "refresh"},
|
||||
@ -163,6 +164,12 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
||||
count += i
|
||||
}
|
||||
m.Log("info", "%v: %v", m.Option("name"), m.Confv("counter", m.Option("name"), fmt.Sprintf("%d", count)))
|
||||
m.Echo("%d", count)
|
||||
}
|
||||
}},
|
||||
"counter": &ctx.Command{Name: "counter name count", Help: "counter", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
||||
if len(arg) > 1 {
|
||||
m.Copy(m.Spawn().Cmd("get", m.Conf("counter_service"), "name", arg[0], "count", arg[1]), "result")
|
||||
}
|
||||
}},
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user