mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-25 16:58:06 +08:00
add some
This commit is contained in:
parent
6e40b977c0
commit
c25cd76e38
@ -5,6 +5,7 @@ import (
|
||||
"contexts/ctx"
|
||||
"encoding/csv"
|
||||
"encoding/json"
|
||||
"os/user"
|
||||
"path"
|
||||
"toolkit"
|
||||
|
||||
@ -168,6 +169,11 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
||||
_, file := path.Split(name)
|
||||
m.Conf("runtime", "boot.pathname", file)
|
||||
}
|
||||
if user, e := user.Current(); e == nil {
|
||||
ns := strings.Split(user.Username, "\\")
|
||||
m.Conf("runtime", "boot.USER", ns[len(ns)-1])
|
||||
m.Conf("runtime", "boot.username", ns[len(ns)-1])
|
||||
}
|
||||
m.Confm("runtime", "init_env", func(index int, key string) {
|
||||
if value := os.Getenv(key); value != "" {
|
||||
m.Conf("runtime", "boot."+key, kit.Select("", value, value != "-"))
|
||||
@ -181,6 +187,15 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
||||
}
|
||||
return
|
||||
}},
|
||||
"publish": &ctx.Command{Name: "publish", Help: "", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||
if user, e := user.Current(); e == nil {
|
||||
ns := strings.Split(user.Username, "\\")
|
||||
m.Conf("runtime", "boot.username", ns[len(ns)-1])
|
||||
m.Echo("%v--\n", ns)
|
||||
m.Echo("%v--\n", ns[len(ns)-1])
|
||||
}
|
||||
return
|
||||
}},
|
||||
"runtime": &ctx.Command{Name: "runtime", Help: "runtime", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||
if len(arg) == 0 {
|
||||
m.Cmdy("ctx.config", "runtime")
|
||||
|
@ -112,23 +112,35 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
||||
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
||||
"componet_type": "private", "componet_ctx": "nfs", "componet_cmd": "dir",
|
||||
"componet_args": []interface{}{}, "inputs": []interface{}{
|
||||
map[string]interface{}{"type": "text", "name": "dir"},
|
||||
map[string]interface{}{"type": "button", "value": "执行"},
|
||||
map[string]interface{}{"type": "text", "name": "dir", "value": "work"},
|
||||
map[string]interface{}{"type": "button", "value": "查看"},
|
||||
},
|
||||
"display": map[string]interface{}{"hide_result": true},
|
||||
"exports": []interface{}{"dir", "filename"},
|
||||
"exports": []interface{}{"dir", "filename", "dir"},
|
||||
},
|
||||
map[string]interface{}{"componet_name": "git", "componet_help": "git",
|
||||
map[string]interface{}{"componet_name": "status", "componet_help": "git",
|
||||
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
||||
"componet_type": "private", "componet_ctx": "cli", "componet_cmd": "git",
|
||||
"componet_args": []interface{}{}, "inputs": []interface{}{
|
||||
map[string]interface{}{"type": "text", "name": "dir", "imports": "plugin_dir"},
|
||||
map[string]interface{}{"type": "select", "name": "cmd", "values": []interface{}{
|
||||
"branch", "status", "diff", "log", "update", "commit", "push",
|
||||
"branch", "status", "diff", "log", "update", "push",
|
||||
}},
|
||||
map[string]interface{}{"type": "button", "value": "执行"},
|
||||
},
|
||||
},
|
||||
map[string]interface{}{"componet_name": "commit", "componet_help": "git",
|
||||
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
||||
"componet_type": "private", "componet_ctx": "cli", "componet_cmd": "git",
|
||||
"componet_args": []interface{}{}, "inputs": []interface{}{
|
||||
map[string]interface{}{"type": "text", "name": "dir", "imports": "plugin_dir"},
|
||||
map[string]interface{}{"type": "select", "name": "cmd", "values": []interface{}{
|
||||
"commit",
|
||||
}},
|
||||
map[string]interface{}{"type": "text", "name": "commit"},
|
||||
map[string]interface{}{"type": "button", "value": "执行"},
|
||||
},
|
||||
},
|
||||
map[string]interface{}{"componet_name": "spide", "componet_help": "spide",
|
||||
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
||||
"componet_type": "private", "componet_ctx": "web", "componet_cmd": "spide",
|
||||
|
@ -394,6 +394,9 @@ function Plugin(field, tool, args, plugin) {
|
||||
(option.ondaemon || function(msg) {
|
||||
output.innerHTML = ""
|
||||
!display.hide_append && msg.append && kit.OrderTable(kit.AppendTable(kit.AppendChild(output, "table"), ctx.Table(msg), msg.append), exports[1], function(event, value) {
|
||||
if (exports.length > 2) {
|
||||
value = option[exports[2]].value + "/" + value
|
||||
}
|
||||
page.Sync("plugin_"+exports[0]).set(value)
|
||||
});
|
||||
(display.show_result || !msg.append) && msg.result && kit.AppendChild(output, [{view: ["code", "div", msg.Results()]}])
|
||||
@ -487,7 +490,7 @@ function Plugin(field, tool, args, plugin) {
|
||||
break
|
||||
|
||||
default:
|
||||
args && count < args.length && (item.value = args[count++])
|
||||
args && count < args.length && (item.value = args[count++]||item.value||"")
|
||||
item.className = "args"
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user