mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-26 01:04:06 +08:00
opt m.Push
This commit is contained in:
parent
f4ef781198
commit
f290ef7853
@ -22,9 +22,9 @@ autocmd BufReadPost * call Shy("read", expand("<afile>"))
|
|||||||
autocmd BufWritePre * call Shy("write", expand("<afile>"))
|
autocmd BufWritePre * call Shy("write", expand("<afile>"))
|
||||||
autocmd BufUnload * call Shy("close", expand("<afile>"))
|
autocmd BufUnload * call Shy("close", expand("<afile>"))
|
||||||
|
|
||||||
autocmd BufWritePost * call Shy("sync", "regs")
|
|
||||||
autocmd BufWritePost * call Shy("sync", "bufs")
|
autocmd BufWritePost * call Shy("sync", "bufs")
|
||||||
autocmd BufWritePost * call Shy("sync", "tags")
|
autocmd BufWritePost * call Shy("sync", "tags")
|
||||||
|
autocmd BufWritePost * call Shy("sync", "regs")
|
||||||
|
|
||||||
" autocmd BufWinEnter * call Shy("enter", expand("<afile>"))
|
" autocmd BufWinEnter * call Shy("enter", expand("<afile>"))
|
||||||
" autocmd WinEnter * call Shy("enter", expand("<afile>"))
|
" autocmd WinEnter * call Shy("enter", expand("<afile>"))
|
||||||
|
@ -852,17 +852,17 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
case "init":
|
case "init":
|
||||||
if _, e := os.Stat(".git"); e == nil {
|
if _, e := os.Stat(".git"); e == nil {
|
||||||
// 更新代码
|
// 更新代码
|
||||||
m.Cmdp(0, []string{"git update"}, []string{"cli.system", "git"}, [][]string{
|
m.Cmdp(0, []string{"git update"}, []string{"web.code.git", ""}, [][]string{
|
||||||
[]string{"stash"}, []string{"pull"}, []string{"stash", "pop"},
|
[]string{"stash"}, []string{"pull"}, []string{"stash", "pop"},
|
||||||
})
|
})
|
||||||
|
|
||||||
// 代码状态
|
// 代码状态
|
||||||
m.Cmdy("cli.system", "git", "status", "-sb", "cmd_parse", "cut")
|
m.Cmdy("web.code.git", "", "status")
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建项目
|
// 创建项目
|
||||||
m.Cmdp(0, []string{"git init"}, []string{"cli.system", "git"}, [][]string{
|
m.Cmdp(0, []string{"git init"}, []string{"web.code.git", ""}, [][]string{
|
||||||
[]string{"init"}, []string{"remote", "add", kit.Select("origin", arg, 1), kit.Select(m.Conf("project", "github"), arg, 2)},
|
[]string{"init"}, []string{"remote", "add", kit.Select("origin", arg, 1), kit.Select(m.Conf("project", "github"), arg, 2)},
|
||||||
[]string{"stash"}, []string{"pull"}, []string{"checkout", "-f", "master"}, []string{"stash", "pop"},
|
[]string{"stash"}, []string{"pull"}, []string{"checkout", "-f", "master"}, []string{"stash", "pop"},
|
||||||
})
|
})
|
||||||
@ -884,33 +884,25 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
|
|
||||||
case "trend":
|
case "trend":
|
||||||
// 提交记录
|
// 提交记录
|
||||||
if len(arg) == 1 {
|
m.Cmdy("web.code.git", "", "sum", arg[1:])
|
||||||
m.Cmdy("nfs.git", "sum", "-n", 20)
|
|
||||||
} else {
|
|
||||||
m.Cmdy("nfs.git", "sum", "--reverse", "--since", arg[1:])
|
|
||||||
}
|
|
||||||
|
|
||||||
case "trends":
|
case "trends":
|
||||||
|
m.Cmdy("web.code.git", "", "sum", "total", arg[1:])
|
||||||
// 提交记录
|
// 提交记录
|
||||||
if len(arg) == 1 {
|
|
||||||
m.Cmdy("nfs.git", "sum", "total")
|
|
||||||
} else {
|
|
||||||
m.Cmdy("nfs.git", "sum", "total", "--reverse", "--since", arg[1])
|
|
||||||
}
|
|
||||||
|
|
||||||
case "submit":
|
case "submit":
|
||||||
// 提交代码
|
// 提交代码
|
||||||
if len(arg) > 1 {
|
if len(arg) > 1 {
|
||||||
m.Cmdp(0, []string{"git submit"}, []string{"cli.system", "git"}, [][]string{
|
m.Cmdp(0, []string{"git submit"}, []string{"web.code.git", ""}, [][]string{
|
||||||
[]string{"commit", "-am", arg[1]}, []string{"push"},
|
[]string{"commit", arg[1]}, []string{"push"},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 提交记录
|
// 提交记录
|
||||||
m.Cmdy("nfs.git", "logs", "table.limit", "3")
|
m.Cmdy("web.code.git", "", "log", "--stat", "-n", "3")
|
||||||
|
|
||||||
case "review":
|
case "review":
|
||||||
// 代码修改
|
// 代码修改
|
||||||
m.Cmdy("cli.system", "git", "diff")
|
m.Cmdy("web.code.git", "", "diff")
|
||||||
|
|
||||||
case "plugin":
|
case "plugin":
|
||||||
// 查看插件
|
// 查看插件
|
||||||
|
@ -241,12 +241,26 @@ func (m *Message) Result(arg ...interface{}) string {
|
|||||||
return m.Insert("result", index, arg...)
|
return m.Insert("result", index, arg...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Message) Push(str string, arg ...interface{}) *Message {
|
func (m *Message) Push(key interface{}, arg ...interface{}) *Message {
|
||||||
switch m.Option("table.format") {
|
switch key := key.(type) {
|
||||||
case "table":
|
case string:
|
||||||
return m.Add("append", "key", str).Add("append", "value", arg...)
|
switch m.Option("table.format") {
|
||||||
|
case "table":
|
||||||
|
m.Add("append", "key", key)
|
||||||
|
key = "value"
|
||||||
|
}
|
||||||
|
return m.Add("append", key, arg...)
|
||||||
|
case []string:
|
||||||
|
for _, key := range key {
|
||||||
|
switch m.Option("table.format") {
|
||||||
|
case "table":
|
||||||
|
m.Add("append", "key", key)
|
||||||
|
key = "value"
|
||||||
|
}
|
||||||
|
m.Add("append", key, kit.Chain(arg[0], key))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return m.Add("append", str, arg...)
|
return m
|
||||||
}
|
}
|
||||||
func (m *Message) Sort(key string, arg ...string) *Message {
|
func (m *Message) Sort(key string, arg ...string) *Message {
|
||||||
cmp := "str"
|
cmp := "str"
|
||||||
|
@ -408,7 +408,6 @@ var Index = &ctx.Context{Name: "yac", Help: "语法中心",
|
|||||||
"pwd": []string{"nfs.pwd"},
|
"pwd": []string{"nfs.pwd"},
|
||||||
"path": []string{"nfs.path"},
|
"path": []string{"nfs.path"},
|
||||||
"dir": []string{"nfs.dir"},
|
"dir": []string{"nfs.dir"},
|
||||||
"git": []string{"nfs.git"},
|
|
||||||
"brow": []string{"web.brow"},
|
"brow": []string{"web.brow"},
|
||||||
"ifconfig": []string{"tcp.ifconfig"},
|
"ifconfig": []string{"tcp.ifconfig"},
|
||||||
}, Help: "启动脚本"},
|
}, Help: "启动脚本"},
|
||||||
|
@ -204,6 +204,9 @@ CMD sh bin/boot.sh
|
|||||||
m.Table()
|
m.Table()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
case "run":
|
||||||
|
arg = arg[1:]
|
||||||
|
fallthrough
|
||||||
default:
|
default:
|
||||||
m.Cmdy(prefix, "send-keys", "-t", target, strings.Join(arg[3:], " "), "Enter")
|
m.Cmdy(prefix, "send-keys", "-t", target, strings.Join(arg[3:], " "), "Enter")
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
@ -344,22 +347,24 @@ CMD sh bin/boot.sh
|
|||||||
case "diff":
|
case "diff":
|
||||||
m.Cmdy(prefix, "diff")
|
m.Cmdy(prefix, "diff")
|
||||||
case "status":
|
case "status":
|
||||||
m.Cmdy(prefix, "status", "-sb", "cmd_parse", "cut", " ", "2")
|
m.Cmdy(prefix, "status", "-sb", "cmd_parse", "cut", " ", "2", "tags file")
|
||||||
case "commit":
|
case "commit":
|
||||||
if m.Cmds(prefix, "commit", "-am") {
|
if len(arg) > 1 && m.Cmds(prefix, "commit", "-am", arg[1]) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
fallthrough
|
m.Cmdy(prefix, "log", "--stat", "-n", "3")
|
||||||
case "sum":
|
case "sum":
|
||||||
total := false
|
total := false
|
||||||
if len(arg) > 1 && arg[1] == "total" {
|
if len(arg) > 1 && arg[1] == "total" {
|
||||||
total, arg = true, arg[1:]
|
total, arg = true, arg[1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
args := []string{}
|
args := []string{"log", "--shortstat", "--pretty=commit: %ad %n%s", "--date=iso", "--reverse"}
|
||||||
if args = append(args, "log", "--shortstat", "--pretty=commit: %ad %n%s", "--date=iso"); len(arg) > 1 {
|
if len(arg) > 1 {
|
||||||
args = append(args, "--reverse")
|
args = append(args, kit.Select("-n", "--since", strings.Contains(arg[1], "-")))
|
||||||
args = append(args, "--since")
|
if strings.Contains(arg[1], "-") && !strings.Contains(arg[1], ":") {
|
||||||
|
arg[1] = arg[1] + " 00:00:00"
|
||||||
|
}
|
||||||
args = append(args, arg[1:]...)
|
args = append(args, arg[1:]...)
|
||||||
} else {
|
} else {
|
||||||
args = append(args, "-n", "30")
|
args = append(args, "-n", "30")
|
||||||
@ -429,39 +434,23 @@ CMD sh bin/boot.sh
|
|||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case "opens":
|
case "opens":
|
||||||
m.Confm("vim", "opens", func(key string, value map[string]interface{}) {
|
m.Confm("vim", "opens", func(key string, value map[string]interface{}) {
|
||||||
m.Push("time", value["time"])
|
m.Push([]string{"time", "action", "file", "pid", "pane", "hostname", "username"}, value)
|
||||||
m.Push("action", value["action"])
|
|
||||||
m.Push("file", value["file"])
|
|
||||||
m.Push("pid", value["pid"])
|
|
||||||
m.Push("pane", value["pane"])
|
|
||||||
m.Push("hostname", value["hostname"])
|
|
||||||
m.Push("username", value["username"])
|
|
||||||
})
|
})
|
||||||
m.Sort("time", "time_r").Table()
|
m.Sort("time", "time_r").Table()
|
||||||
case "bufs":
|
case "bufs":
|
||||||
m.Confm("vim", "buffer", func(key string, index int, value map[string]interface{}) {
|
m.Confm("vim", "buffer", func(key string, index int, value map[string]interface{}) {
|
||||||
m.Push("id", value["id"])
|
m.Push([]string{"id", "tag", "name", "line", "hostname", "username"}, value)
|
||||||
m.Push("name", value["name"])
|
|
||||||
m.Push("line", value["line"])
|
|
||||||
m.Push("hostname", value["hostname"])
|
|
||||||
m.Push("username", value["username"])
|
|
||||||
})
|
})
|
||||||
m.Table()
|
m.Table()
|
||||||
case "regs":
|
case "regs":
|
||||||
m.Confm("vim", "register", func(key string, index int, value map[string]interface{}) {
|
m.Confm("vim", "register", func(key string, index int, value map[string]interface{}) {
|
||||||
m.Push("name", value["name"])
|
m.Push([]string{"name", "text", "hostname", "username"}, value)
|
||||||
m.Push("text", value["text"])
|
|
||||||
m.Push("hostname", value["hostname"])
|
|
||||||
m.Push("username", value["username"])
|
|
||||||
})
|
})
|
||||||
m.Table()
|
m.Table()
|
||||||
case "tags":
|
case "tags":
|
||||||
m.Confm("vim", "tag", func(key string, index int, value map[string]interface{}) {
|
m.Confm("vim", "tag", func(key string, index int, value map[string]interface{}) {
|
||||||
m.Push("tag", value["tag"])
|
value["file"] = value["in file/text"]
|
||||||
m.Push("line", value["line"])
|
m.Push([]string{"tag", "line", "file", "hostname", "username"}, value)
|
||||||
m.Push("file", value["in file/text"])
|
|
||||||
m.Push("hostname", value["hostname"])
|
|
||||||
m.Push("username", value["username"])
|
|
||||||
})
|
})
|
||||||
m.Table()
|
m.Table()
|
||||||
}
|
}
|
||||||
@ -512,6 +501,7 @@ CMD sh bin/boot.sh
|
|||||||
"hostname": m.Option("hostname"),
|
"hostname": m.Option("hostname"),
|
||||||
"username": m.Option("username"),
|
"username": m.Option("username"),
|
||||||
"id": value["id"],
|
"id": value["id"],
|
||||||
|
"tag": value["tag"],
|
||||||
"name": value["name"],
|
"name": value["name"],
|
||||||
"line": value["line"],
|
"line": value["line"],
|
||||||
})
|
})
|
||||||
|
@ -22,7 +22,7 @@ kit tmux "终端" private "web.code.tmux" \
|
|||||||
text "" name pane imports plugin_pane view char action auto \
|
text "" name pane imports plugin_pane view char action auto \
|
||||||
text "" name cmd \
|
text "" name cmd \
|
||||||
exports session session "" window window "" pane pane "" \
|
exports session session "" window window "" pane pane "" \
|
||||||
feature detail "复制" "下载" "修改" \
|
ueature detail "复制" "下载" "修改" \
|
||||||
button "查看" action auto \
|
button "查看" action auto \
|
||||||
button "返回" cb Last
|
button "返回" cb Last
|
||||||
|
|
||||||
@ -50,8 +50,8 @@ kit network "网络" private "web.code.docker" "network" \
|
|||||||
button "查看"
|
button "查看"
|
||||||
|
|
||||||
kit volume "存储" private "web.code.docker" "volume" \
|
kit volume "存储" private "web.code.docker" "volume" \
|
||||||
text "" name arg imports plugin_CONTAINER_ID \
|
text "" name arg imports plugin_VOLUME_NAME \
|
||||||
exports CONTAINER_ID CONTAINER_ID \
|
exports VOLUME_NAME VOLUME_NAME \
|
||||||
button "查看"
|
button "查看"
|
||||||
|
|
||||||
kit git "记录" private "ssh._route" _ "web.code.git" \
|
kit git "记录" private "ssh._route" _ "web.code.git" \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user