mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-26 09:14:06 +08:00
add cli.missyou
This commit is contained in:
parent
3c4b9118d7
commit
2a0278790f
@ -178,6 +178,9 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
"librarys_tar_gz": "usr/librarys.tar.gz",
|
"librarys_tar_gz": "usr/librarys.tar.gz",
|
||||||
},
|
},
|
||||||
}, Help: "日志地址"},
|
}, Help: "日志地址"},
|
||||||
|
"missyou": &ctx.Config{Name: "missyou", Value: map[string]interface{}{
|
||||||
|
"path": "usr/work",
|
||||||
|
}, Help: "免密登录"},
|
||||||
|
|
||||||
"plugin": &ctx.Config{Name: "plugin", Value: map[string]interface{}{
|
"plugin": &ctx.Config{Name: "plugin", Value: map[string]interface{}{
|
||||||
"go": map[string]interface{}{
|
"go": map[string]interface{}{
|
||||||
@ -545,19 +548,14 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
[]string{"stash", "pop"},
|
[]string{"stash", "pop"},
|
||||||
})
|
})
|
||||||
|
|
||||||
list := [][]string{}
|
|
||||||
m.Confm("project", "import", func(index int, value string) {
|
|
||||||
list = append(list, []string{value})
|
|
||||||
})
|
|
||||||
|
|
||||||
m.Cmdp(time.Second, []string{"go init"}, []string{"cli.system", "go", "get",
|
|
||||||
"cmd_env", "GOPATH", m.Conf("runtime", "boot.ctx_path")}, list)
|
|
||||||
|
|
||||||
case "import":
|
case "import":
|
||||||
list := [][]string{}
|
list := [][]string{}
|
||||||
m.Confm("project", "import", func(index int, value string) {
|
m.Confm("project", "import", func(index int, value string) {
|
||||||
list = append(list, []string{value})
|
list = append(list, []string{value})
|
||||||
|
m.Add("append", "time", m.Time())
|
||||||
|
m.Add("append", "package", value)
|
||||||
})
|
})
|
||||||
|
m.Table()
|
||||||
|
|
||||||
m.Cmdp(time.Second, []string{"go init"}, []string{"cli.system", "go", "get",
|
m.Cmdp(time.Second, []string{"go init"}, []string{"cli.system", "go", "get",
|
||||||
"cmd_env", "GOPATH", m.Conf("runtime", "boot.ctx_path")}, list)
|
"cmd_env", "GOPATH", m.Conf("runtime", "boot.ctx_path")}, list)
|
||||||
@ -625,19 +623,23 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, key := range arg {
|
for _, key := range arg {
|
||||||
|
key = kit.Key(key)
|
||||||
value := m.Conf("publish", []string{"list", key})
|
value := m.Conf("publish", []string{"list", key})
|
||||||
p := m.Cmdx("nfs.path", value)
|
p := m.Cmdx("nfs.path", value)
|
||||||
|
q := path.Join(dir, key)
|
||||||
if s, e := os.Stat(p); e == nil {
|
if s, e := os.Stat(p); e == nil {
|
||||||
if s.IsDir() {
|
if s.IsDir() {
|
||||||
m.Cmd("cli.system", "tar", "-zcf", path.Join(dir, key), "-C", path.Dir(p), path.Base(value))
|
m.Cmd("cli.system", "tar", "-zcf", q, "-C", path.Dir(p), path.Base(value))
|
||||||
} else {
|
} else {
|
||||||
m.Cmd("nfs.copy", path.Join(dir, key), p)
|
m.Cmd("nfs.copy", q, p)
|
||||||
|
}
|
||||||
|
m.Add("append", "time", m.Time())
|
||||||
|
m.Add("append", "file", q)
|
||||||
|
m.Add("append", "hash", kit.Hashs(p))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
m.Table()
|
||||||
|
|
||||||
// m.Cmdy("nfs.dir", dir, "dir_sort", "time", "time_r")
|
// m.Cmdy("nfs.dir", dir, "dir_sort", "time", "time_r")
|
||||||
|
|
||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
"upgrade": &ctx.Command{Name: "upgrade project|bench|system|portal|script", Help: "服务升级", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
"upgrade": &ctx.Command{Name: "upgrade project|bench|system|portal|script", Help: "服务升级", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
@ -688,6 +690,17 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
|
"missyou": &ctx.Command{Name: "missyou", Help: "服务升级", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
|
if len(arg) == 0 {
|
||||||
|
m.Option("dir_root", "")
|
||||||
|
m.Cmdy("nfs.dir", m.Conf("missyou", "path"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
m.Cmdy("cli.system", "node.sh", "create", path.Join(m.Conf("missyou", "path"), m.Time("20060102-")+arg[0]),
|
||||||
|
"daemon", "cmd_daemon", "true")
|
||||||
|
return
|
||||||
|
}},
|
||||||
"quit": &ctx.Command{Name: "quit code", Help: "停止服务", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
"quit": &ctx.Command{Name: "quit code", Help: "停止服务", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
code := kit.Select("0", arg, 0)
|
code := kit.Select("0", arg, 0)
|
||||||
switch code {
|
switch code {
|
||||||
@ -704,12 +717,17 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
m.Echo("restart")
|
m.Echo("restart")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.Append("directory", "")
|
m.Append("time", m.Time())
|
||||||
m.Echo(", wait 1s")
|
m.Append("code", code)
|
||||||
|
m.Echo(", wait 1s\n")
|
||||||
|
m.Table()
|
||||||
m.GoFunc(m, func(m *ctx.Message) {
|
m.GoFunc(m, func(m *ctx.Message) {
|
||||||
time.Sleep(time.Second * 1)
|
defer func() {
|
||||||
m.Cmd("nfs._exit")
|
|
||||||
os.Exit(kit.Int(code))
|
os.Exit(kit.Int(code))
|
||||||
|
}()
|
||||||
|
time.Sleep(time.Second * 1)
|
||||||
|
m.Cmd("cli._exit")
|
||||||
|
m.Cmd("nfs._exit")
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
@ -781,6 +799,7 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
default:
|
default:
|
||||||
m.Cmdy("system", m.Conf("system", []string{"script", strings.TrimPrefix(path.Ext(p), ".")}), arg)
|
m.Cmdy("system", m.Conf("system", []string{"script", strings.TrimPrefix(path.Ext(p), ".")}), arg)
|
||||||
}
|
}
|
||||||
|
m.Append("directory", "")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -895,7 +914,7 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
timer["msg"] = msg.Code()
|
timer["msg"] = msg.Code()
|
||||||
|
|
||||||
if timer["repeat"].(bool) {
|
if timer["repeat"].(bool) {
|
||||||
timer["action_time"] = int64(m.Sess("cli").Cmd("time", timer["action_time"], timer["order"], timer["time"]).Appendi("timestamp"))
|
timer["action_time"] = int64(m.Sess("cli").Cmd("time", msg.Time(), timer["order"], timer["time"]).Appendi("timestamp"))
|
||||||
} else {
|
} else {
|
||||||
timer["done"] = true
|
timer["done"] = true
|
||||||
}
|
}
|
||||||
|
@ -694,18 +694,23 @@ var Index = &Context{Name: "ctx", Help: "模块中心", Server: &CTX{},
|
|||||||
all, arg = true, arg[1:]
|
all, arg = true, arg[1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
action := "show"
|
action := ""
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case "show", "list", "add", "delete":
|
case "show", "list", "add", "delete":
|
||||||
action, arg = arg[0], arg[1:]
|
action, arg = arg[0], arg[1:]
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
action = "show"
|
||||||
}
|
}
|
||||||
|
|
||||||
switch action {
|
switch action {
|
||||||
case "show":
|
case "show":
|
||||||
c.BackTrace(m, func(m *Message) bool {
|
c.BackTrace(m, func(m *Message) bool {
|
||||||
for k, v := range m.target.Commands {
|
for k, v := range m.target.Commands {
|
||||||
|
if strings.HasPrefix(k, "_") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
if k == arg[0] {
|
if k == arg[0] {
|
||||||
m.Add("append", "key", k)
|
m.Add("append", "key", k)
|
||||||
@ -825,6 +830,10 @@ var Index = &Context{Name: "ctx", Help: "模块中心", Server: &CTX{},
|
|||||||
delete(m.target.Commands, arg[0])
|
delete(m.target.Commands, arg[0])
|
||||||
return !all
|
return !all
|
||||||
})
|
})
|
||||||
|
default:
|
||||||
|
if len(arg) > 0 {
|
||||||
|
m.Cmdy(arg)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
|
@ -891,6 +891,7 @@ func (nfs *NFS) Start(m *ctx.Message, arg ...string) bool {
|
|||||||
if nfs.out = m.Optionv("out").(*os.File); m.Cap("goos") != "windows" && !m.Options("daemon") {
|
if nfs.out = m.Optionv("out").(*os.File); m.Cap("goos") != "windows" && !m.Options("daemon") {
|
||||||
kit.STDIO = nfs
|
kit.STDIO = nfs
|
||||||
nfs.Term(m, "init")
|
nfs.Term(m, "init")
|
||||||
|
m.Conf("term", "use", true)
|
||||||
defer nfs.Term(m, "exit")
|
defer nfs.Term(m, "exit")
|
||||||
}
|
}
|
||||||
if what := make(chan bool); m.Options("daemon") {
|
if what := make(chan bool); m.Options("daemon") {
|
||||||
@ -1047,6 +1048,7 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心",
|
|||||||
},
|
},
|
||||||
Configs: map[string]*ctx.Config{
|
Configs: map[string]*ctx.Config{
|
||||||
"term": &ctx.Config{Name: "term", Value: map[string]interface{}{
|
"term": &ctx.Config{Name: "term", Value: map[string]interface{}{
|
||||||
|
"use": "false",
|
||||||
"mouse": map[string]interface{}{
|
"mouse": map[string]interface{}{
|
||||||
"resize": false,
|
"resize": false,
|
||||||
},
|
},
|
||||||
@ -1147,7 +1149,9 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心",
|
|||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
"_exit": &ctx.Command{Name: "_init", Help: "", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
"_exit": &ctx.Command{Name: "_init", Help: "", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
|
if m.Confs("term", "use") {
|
||||||
termbox.Close()
|
termbox.Close()
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
"pwd": &ctx.Command{Name: "pwd [all] | [[index] path] ", Help: "工作目录,all: 查看所有, index path: 设置路径, path: 设置当前路径", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
"pwd": &ctx.Command{Name: "pwd [all] | [[index] path] ", Help: "工作目录,all: 查看所有, index path: 设置路径, path: 设置当前路径", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
|
@ -45,121 +45,12 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
|||||||
"trust": &ctx.Config{Name: "trust", Value: map[string]interface{}{"fresh": false, "user": true, "up": true}, Help: "可信节点"},
|
"trust": &ctx.Config{Name: "trust", Value: map[string]interface{}{"fresh": false, "user": true, "up": true}, Help: "可信节点"},
|
||||||
"timer": &ctx.Config{Name: "timer", Value: map[string]interface{}{"interval": "10s", "timer": ""}, Help: "断线重连"},
|
"timer": &ctx.Config{Name: "timer", Value: map[string]interface{}{"interval": "10s", "timer": ""}, Help: "断线重连"},
|
||||||
"componet": &ctx.Config{Name: "componet", Value: map[string]interface{}{
|
"componet": &ctx.Config{Name: "componet", Value: map[string]interface{}{
|
||||||
"index": []interface{}{
|
|
||||||
map[string]interface{}{"componet_name": "salary", "componet_help": "计算工资",
|
|
||||||
"componet_tmpl": "componet", "componet_view": "Salary", "componet_init": "",
|
|
||||||
"componet_type": "public", "componet_ctx": "web.chat", "componet_cmd": "salary",
|
|
||||||
"componet_args": []interface{}{}, "inputs": []interface{}{
|
|
||||||
map[string]interface{}{"label": "total", "type": "text", "name": "text"},
|
|
||||||
map[string]interface{}{"label": "base", "type": "text", "name": "total"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
map[string]interface{}{"componet_name": "qrcode", "componet_help": "生成二维码",
|
|
||||||
"componet_tmpl": "componet", "componet_view": "QRCode", "componet_init": "initQRCode.js",
|
|
||||||
"componet_type": "public", "componet_ctx": "web.chat", "componet_cmd": "login",
|
|
||||||
"componet_args": []interface{}{"qrcode"}, "inputs": []interface{}{
|
|
||||||
map[string]interface{}{"label": "content", "type": "text", "name": "content"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
map[string]interface{}{"componet_name": "clip", "componet_help": "粘贴板",
|
|
||||||
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
|
||||||
"componet_type": "public", "componet_ctx": "aaa", "componet_cmd": "clip",
|
|
||||||
"componet_args": []interface{}{}, "inputs": []interface{}{
|
|
||||||
map[string]interface{}{"label": "content", "type": "text", "name": "content"},
|
|
||||||
map[string]interface{}{"type": "button", "value": "运行"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"project": []interface{}{
|
|
||||||
map[string]interface{}{"componet_name": "context", "componet_help": "context",
|
|
||||||
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
|
||||||
"componet_type": "private", "componet_ctx": "ctx", "componet_cmd": "context",
|
|
||||||
"componet_args": []interface{}{}, "inputs": []interface{}{
|
|
||||||
map[string]interface{}{"type": "button", "value": "模块"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
map[string]interface{}{"componet_name": "ifconfig", "componet_help": "ifconfig",
|
|
||||||
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
|
||||||
"componet_type": "private", "componet_ctx": "tcp", "componet_cmd": "ifconfig",
|
|
||||||
"componet_args": []interface{}{}, "inputs": []interface{}{
|
|
||||||
map[string]interface{}{"type": "button", "value": "网卡"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
map[string]interface{}{"componet_name": "pod", "componet_help": "pod",
|
|
||||||
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
|
||||||
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "remote",
|
|
||||||
"componet_args": []interface{}{}, "inputs": []interface{}{
|
|
||||||
map[string]interface{}{"type": "button", "value": "执行"},
|
|
||||||
},
|
|
||||||
"exports": []interface{}{"pod", "key"},
|
|
||||||
},
|
|
||||||
map[string]interface{}{"componet_name": "dir", "componet_help": "dir",
|
|
||||||
"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", "value": "work"},
|
|
||||||
map[string]interface{}{"type": "button", "value": "查看"},
|
|
||||||
},
|
|
||||||
"display": map[string]interface{}{"hide_result": true},
|
|
||||||
"exports": []interface{}{"dir", "filename", "dir"},
|
|
||||||
},
|
|
||||||
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", "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",
|
|
||||||
"componet_args": []interface{}{}, "inputs": []interface{}{
|
|
||||||
map[string]interface{}{"type": "button", "value": "执行"},
|
|
||||||
},
|
|
||||||
"exports": []interface{}{"site", "key"},
|
|
||||||
},
|
|
||||||
map[string]interface{}{"componet_name": "get", "componet_help": "get",
|
|
||||||
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
|
||||||
"componet_type": "private", "componet_ctx": "web", "componet_cmd": "get",
|
|
||||||
"componet_args": []interface{}{}, "inputs": []interface{}{
|
|
||||||
map[string]interface{}{"type": "text", "name": "spide", "imports": "plugin_site"},
|
|
||||||
map[string]interface{}{"type": "text", "name": "url"},
|
|
||||||
map[string]interface{}{"type": "button", "value": "执行"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
map[string]interface{}{"componet_name": "post", "componet_help": "post",
|
|
||||||
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
|
||||||
"componet_type": "private", "componet_ctx": "web", "componet_cmd": "post",
|
|
||||||
"componet_args": []interface{}{"content_type", "application/json", "parse", "json"}, "inputs": []interface{}{
|
|
||||||
map[string]interface{}{"type": "text", "name": "spide", "imports": "plugin_site"},
|
|
||||||
map[string]interface{}{"type": "text", "name": "url"},
|
|
||||||
map[string]interface{}{"type": "button", "value": "执行"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"company": []interface{}{
|
"company": []interface{}{
|
||||||
map[string]interface{}{"componet_name": "status", "componet_help": "status",
|
map[string]interface{}{"componet_name": "status", "componet_help": "status",
|
||||||
"componet_tmpl": "componet", "componet_view": "Company", "componet_init": "",
|
"componet_tmpl": "componet", "componet_view": "Company", "componet_init": "",
|
||||||
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
||||||
"componet_args": []interface{}{}, "inputs": []interface{}{
|
"componet_args": []interface{}{"$$", "gg"}, "inputs": []interface{}{
|
||||||
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
|
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
|
||||||
map[string]interface{}{"type": "text", "name": "cmd", "value": "gg", "view": "hide"},
|
|
||||||
map[string]interface{}{"type": "select", "name": "sub", "values": []interface{}{"status", ""}},
|
map[string]interface{}{"type": "select", "name": "sub", "values": []interface{}{"status", ""}},
|
||||||
map[string]interface{}{"type": "button", "value": "执行"},
|
map[string]interface{}{"type": "button", "value": "执行"},
|
||||||
},
|
},
|
||||||
@ -167,9 +58,8 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
|||||||
map[string]interface{}{"componet_name": "deploy", "componet_help": "deploy",
|
map[string]interface{}{"componet_name": "deploy", "componet_help": "deploy",
|
||||||
"componet_tmpl": "componet", "componet_view": "Company", "componet_init": "",
|
"componet_tmpl": "componet", "componet_view": "Company", "componet_init": "",
|
||||||
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
||||||
"componet_args": []interface{}{}, "inputs": []interface{}{
|
"componet_args": []interface{}{"$$", "gg"}, "inputs": []interface{}{
|
||||||
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
|
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
|
||||||
map[string]interface{}{"type": "text", "name": "cmd", "value": "gg", "view": "hide"},
|
|
||||||
map[string]interface{}{"type": "select", "name": "sub", "values": []interface{}{"deploygo", "deploy"}},
|
map[string]interface{}{"type": "select", "name": "sub", "values": []interface{}{"deploygo", "deploy"}},
|
||||||
map[string]interface{}{"type": "text", "name": "sub", "imports": "plugin_dir"},
|
map[string]interface{}{"type": "text", "name": "sub", "imports": "plugin_dir"},
|
||||||
map[string]interface{}{"type": "text", "name": "sub", "imports": "plugin_branch"},
|
map[string]interface{}{"type": "text", "name": "sub", "imports": "plugin_branch"},
|
||||||
@ -179,9 +69,8 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
|||||||
map[string]interface{}{"componet_name": "php", "componet_help": "php",
|
map[string]interface{}{"componet_name": "php", "componet_help": "php",
|
||||||
"componet_tmpl": "componet", "componet_view": "Company", "componet_init": "",
|
"componet_tmpl": "componet", "componet_view": "Company", "componet_init": "",
|
||||||
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
||||||
"componet_args": []interface{}{}, "inputs": []interface{}{
|
"componet_args": []interface{}{"$$", "php"}, "inputs": []interface{}{
|
||||||
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
|
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
|
||||||
map[string]interface{}{"type": "text", "name": "cmd", "value": "php"},
|
|
||||||
map[string]interface{}{"type": "text", "name": "cmd", "value": "usr/script/test.php"},
|
map[string]interface{}{"type": "text", "name": "cmd", "value": "usr/script/test.php"},
|
||||||
map[string]interface{}{"type": "button", "value": "执行"},
|
map[string]interface{}{"type": "button", "value": "执行"},
|
||||||
},
|
},
|
||||||
@ -189,12 +78,9 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
|||||||
map[string]interface{}{"componet_name": "redis", "componet_help": "redis",
|
map[string]interface{}{"componet_name": "redis", "componet_help": "redis",
|
||||||
"componet_tmpl": "componet", "componet_view": "Company", "componet_init": "",
|
"componet_tmpl": "componet", "componet_view": "Company", "componet_init": "",
|
||||||
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
||||||
"componet_args": []interface{}{}, "inputs": []interface{}{
|
"componet_args": []interface{}{"$$", "context", "mdb", "redis"}, "inputs": []interface{}{
|
||||||
map[string]interface{}{"type": "text", "name": "pod"},
|
map[string]interface{}{"type": "text", "name": "pod"},
|
||||||
map[string]interface{}{"type": "text", "name": "cmd", "value": "context", "view": "hide"},
|
map[string]interface{}{"type": "text", "name": "cmd", "values": []interface{}{"get", "del"}},
|
||||||
map[string]interface{}{"type": "text", "name": "cmd", "value": "mdb", "view": "hide"},
|
|
||||||
map[string]interface{}{"type": "text", "name": "cmd", "value": "redis", "view": "hide"},
|
|
||||||
map[string]interface{}{"type": "text", "name": "cmd", "value": "get"},
|
|
||||||
map[string]interface{}{"type": "text", "name": "cmd", "value": "test"},
|
map[string]interface{}{"type": "text", "name": "cmd", "value": "test"},
|
||||||
map[string]interface{}{"type": "button", "value": "执行"},
|
map[string]interface{}{"type": "button", "value": "执行"},
|
||||||
},
|
},
|
||||||
@ -220,20 +106,167 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
|||||||
"componet_tmpl": "componet", "componet_view": "Compile", "componet_init": "",
|
"componet_tmpl": "componet", "componet_view": "Compile", "componet_init": "",
|
||||||
"componet_type": "private", "componet_ctx": "cli", "componet_cmd": "compile",
|
"componet_type": "private", "componet_ctx": "cli", "componet_cmd": "compile",
|
||||||
"componet_args": []interface{}{}, "inputs": []interface{}{
|
"componet_args": []interface{}{}, "inputs": []interface{}{
|
||||||
map[string]interface{}{"type": "text", "name": "action"},
|
map[string]interface{}{"type": "select", "name": "action", "values": []interface{}{"linux", "darwin", "windows", "self", "all"}},
|
||||||
map[string]interface{}{"type": "button", "value": "编译"},
|
map[string]interface{}{"type": "button", "value": "编译"},
|
||||||
},
|
},
|
||||||
"display": map[string]interface{}{"hide_append": true, "show_result": true},
|
"display": map[string]interface{}{"hide_append": true, "show_result": true},
|
||||||
},
|
},
|
||||||
map[string]interface{}{"componet_name": "publish", "componet_help": "publish",
|
map[string]interface{}{"componet_name": "publish", "componet_help": "publish",
|
||||||
"componet_tmpl": "componet", "componet_view": "Compile", "componet_init": "",
|
"componet_tmpl": "componet", "componet_view": "Compile", "componet_init": "",
|
||||||
"componet_type": "private", "componet_ctx": "cli", "componet_cmd": "compile",
|
"componet_type": "private", "componet_ctx": "cli", "componet_cmd": "publish",
|
||||||
"componet_args": []interface{}{}, "inputs": []interface{}{
|
"componet_args": []interface{}{}, "inputs": []interface{}{
|
||||||
map[string]interface{}{"type": "text", "name": "action"},
|
map[string]interface{}{"type": "text", "name": "action"},
|
||||||
map[string]interface{}{"type": "button", "value": "编译"},
|
map[string]interface{}{"type": "button", "value": "发布"},
|
||||||
},
|
},
|
||||||
"display": map[string]interface{}{"hide_append": true, "show_result": true},
|
"display": map[string]interface{}{"hide_append": true, "show_result": true},
|
||||||
},
|
},
|
||||||
|
map[string]interface{}{"componet_name": "upgrade", "componet_help": "upgrade",
|
||||||
|
"componet_tmpl": "componet", "componet_view": "Compile", "componet_init": "",
|
||||||
|
"componet_type": "private", "componet_ctx": "cli", "componet_cmd": "upgrade",
|
||||||
|
"componet_args": []interface{}{}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"type": "select", "name": "action", "values": []interface{}{"bench", "system", "portal", "script"}},
|
||||||
|
map[string]interface{}{"type": "text", "name": "action"},
|
||||||
|
map[string]interface{}{"type": "button", "value": "升级"},
|
||||||
|
},
|
||||||
|
"display": map[string]interface{}{"hide_append": true, "show_result": true},
|
||||||
|
},
|
||||||
|
map[string]interface{}{"componet_name": "missyou", "componet_help": "missyou",
|
||||||
|
"componet_tmpl": "componet", "componet_view": "Compile", "componet_init": "",
|
||||||
|
"componet_type": "private", "componet_ctx": "cli", "componet_cmd": "missyou",
|
||||||
|
"componet_args": []interface{}{}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"type": "text", "name": "action"},
|
||||||
|
map[string]interface{}{"type": "button", "value": "行动"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"favor": []interface{}{
|
||||||
|
map[string]interface{}{"componet_name": "salary", "componet_help": "计算工资",
|
||||||
|
"componet_tmpl": "componet", "componet_view": "Salary", "componet_init": "",
|
||||||
|
"componet_type": "public", "componet_ctx": "web.chat", "componet_cmd": "salary",
|
||||||
|
"componet_args": []interface{}{}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"label": "total", "type": "text", "name": "text"},
|
||||||
|
map[string]interface{}{"label": "base", "type": "text", "name": "total"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
map[string]interface{}{"componet_name": "qrcode", "componet_help": "生成二维码",
|
||||||
|
"componet_tmpl": "componet", "componet_view": "QRCode", "componet_init": "initQRCode.js",
|
||||||
|
"componet_type": "public", "componet_ctx": "web.chat", "componet_cmd": "login",
|
||||||
|
"componet_args": []interface{}{"qrcode"}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"label": "content", "type": "text", "name": "content"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
map[string]interface{}{"componet_name": "clip", "componet_help": "粘贴板",
|
||||||
|
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
||||||
|
"componet_type": "public", "componet_ctx": "aaa", "componet_cmd": "clip",
|
||||||
|
"componet_args": []interface{}{}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"label": "content", "type": "text", "name": "content"},
|
||||||
|
map[string]interface{}{"type": "button", "value": "运行"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"index": []interface{}{
|
||||||
|
map[string]interface{}{"componet_name": "pod", "componet_help": "pod",
|
||||||
|
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
||||||
|
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "remote",
|
||||||
|
"componet_args": []interface{}{}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"type": "button", "value": "执行"},
|
||||||
|
},
|
||||||
|
"exports": []interface{}{"pod", "key"},
|
||||||
|
},
|
||||||
|
map[string]interface{}{"componet_name": "ctx", "componet_help": "ctx",
|
||||||
|
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
||||||
|
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
||||||
|
"componet_args": []interface{}{"$$", "context", "$$", "context"}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
|
||||||
|
map[string]interface{}{"type": "text", "name": "ctx", "value": "nfs"},
|
||||||
|
map[string]interface{}{"type": "button", "value": "模块"},
|
||||||
|
},
|
||||||
|
"exports": []interface{}{"ctx", "names"},
|
||||||
|
},
|
||||||
|
map[string]interface{}{"componet_name": "cmd", "componet_help": "cmd",
|
||||||
|
"componet_tmpl": "componet", "componet_view": "Company", "componet_init": "",
|
||||||
|
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
||||||
|
"componet_args": []interface{}{"$$", "context", "$$", "command"}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
|
||||||
|
map[string]interface{}{"type": "text", "name": "ctx", "value": "nfs", "imports": "plugin_ctx"},
|
||||||
|
map[string]interface{}{"type": "text", "name": "cmd", "value": "pwd"},
|
||||||
|
map[string]interface{}{"type": "button", "value": "执行"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
map[string]interface{}{"componet_name": "dir", "componet_help": "dir",
|
||||||
|
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
||||||
|
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
||||||
|
"componet_args": []interface{}{"$$", "context", "nfs", "dir"}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
|
||||||
|
map[string]interface{}{"type": "text", "name": "dir", "value": ""},
|
||||||
|
map[string]interface{}{"type": "button", "value": "查看"},
|
||||||
|
},
|
||||||
|
"display": map[string]interface{}{"hide_result": true},
|
||||||
|
"exports": []interface{}{"dir", "filename", "dir"},
|
||||||
|
},
|
||||||
|
map[string]interface{}{"componet_name": "status", "componet_help": "git",
|
||||||
|
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
||||||
|
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
||||||
|
"componet_args": []interface{}{"$$", "context", "nfs", "git"}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
|
||||||
|
map[string]interface{}{"type": "text", "name": "dir", "imports": "plugin_dir"},
|
||||||
|
map[string]interface{}{"type": "select", "name": "cmd", "values": []interface{}{
|
||||||
|
"branch", "status", "diff", "log", "update", "push", "init",
|
||||||
|
}},
|
||||||
|
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": "ssh", "componet_cmd": "_route",
|
||||||
|
"componet_args": []interface{}{"$$", "git"}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
|
||||||
|
map[string]interface{}{"type": "text", "name": "dir", "imports": "plugin_dir"},
|
||||||
|
map[string]interface{}{"type": "select", "name": "cmd", "values": []interface{}{
|
||||||
|
"commit", "add",
|
||||||
|
}},
|
||||||
|
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": "ssh", "componet_cmd": "_route",
|
||||||
|
"componet_args": []interface{}{"$$", "context", "web", "spide"}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
|
||||||
|
map[string]interface{}{"type": "button", "value": "执行"},
|
||||||
|
},
|
||||||
|
"exports": []interface{}{"site", "key"},
|
||||||
|
},
|
||||||
|
map[string]interface{}{"componet_name": "post", "componet_help": "post",
|
||||||
|
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
||||||
|
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
||||||
|
"componet_args": []interface{}{"$$", "context", "web", "post", "$$", "content_type", "application/json", "parse", "json"}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
|
||||||
|
map[string]interface{}{"type": "text", "name": "spide", "imports": "plugin_site"},
|
||||||
|
map[string]interface{}{"type": "text", "name": "url", "value": "/"},
|
||||||
|
map[string]interface{}{"type": "button", "value": "执行"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
map[string]interface{}{"componet_name": "get", "componet_help": "get",
|
||||||
|
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
||||||
|
"componet_type": "private", "componet_ctx": "ssh", "componet_cmd": "_route",
|
||||||
|
"componet_args": []interface{}{"$$", "context", "web", "get"}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"type": "text", "name": "pod", "imports": "plugin_pod"},
|
||||||
|
map[string]interface{}{"type": "text", "name": "spide", "imports": "plugin_site"},
|
||||||
|
map[string]interface{}{"type": "text", "name": "url", "value": "/"},
|
||||||
|
map[string]interface{}{"type": "button", "value": "执行"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"other": []interface{}{
|
||||||
|
map[string]interface{}{"componet_name": "ifconfig", "componet_help": "ifconfig",
|
||||||
|
"componet_tmpl": "componet", "componet_view": "Context", "componet_init": "",
|
||||||
|
"componet_type": "private", "componet_ctx": "tcp", "componet_cmd": "ifconfig",
|
||||||
|
"componet_args": []interface{}{}, "inputs": []interface{}{
|
||||||
|
map[string]interface{}{"type": "button", "value": "网卡"},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}, Help: "组件列表"},
|
}, Help: "组件列表"},
|
||||||
},
|
},
|
||||||
@ -398,11 +431,21 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
|||||||
|
|
||||||
msg := m.Find(kit.Format(tool["componet_ctx"]))
|
msg := m.Find(kit.Format(tool["componet_ctx"]))
|
||||||
|
|
||||||
|
arg = arg[4:]
|
||||||
args := []string{}
|
args := []string{}
|
||||||
for _, v := range kit.Trans(tool["componet_args"]) {
|
for _, v := range kit.Trans(tool["componet_args"]) {
|
||||||
|
if v == "$$" {
|
||||||
|
if len(arg) > 0 {
|
||||||
|
args = append(args, arg[0])
|
||||||
|
arg = arg[1:]
|
||||||
|
} else {
|
||||||
|
args = append(args, "")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
args = append(args, msg.Parse(v))
|
args = append(args, msg.Parse(v))
|
||||||
}
|
}
|
||||||
msg.Cmd(tool["componet_cmd"], args, arg[4:]).CopyTo(m)
|
}
|
||||||
|
msg.Cmd(tool["componet_cmd"], args, arg).CopyTo(m)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
m.Confm("componet", arg[0:], func(value map[string]interface{}) {
|
m.Confm("componet", arg[0:], func(value map[string]interface{}) {
|
||||||
@ -459,6 +502,9 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
|||||||
m.Cmd("ssh._node", "init")
|
m.Cmd("ssh._node", "init")
|
||||||
|
|
||||||
m.Call(func(nfs *ctx.Message) *ctx.Message {
|
m.Call(func(nfs *ctx.Message) *ctx.Message {
|
||||||
|
if m.Caps("stream") {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
// 删除重连
|
// 删除重连
|
||||||
if m.Confs("timer", "timer") {
|
if m.Confs("timer", "timer") {
|
||||||
m.Conf("timer", "timer", m.Cmdx("cli.timer", "delete", m.Conf("timer", "timer")))
|
m.Conf("timer", "timer", m.Cmdx("cli.timer", "delete", m.Conf("timer", "timer")))
|
||||||
@ -466,6 +512,9 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
|||||||
|
|
||||||
// 注册设备
|
// 注册设备
|
||||||
m.Spawn(nfs.Target()).Call(func(node *ctx.Message) *ctx.Message {
|
m.Spawn(nfs.Target()).Call(func(node *ctx.Message) *ctx.Message {
|
||||||
|
if m.Caps("stream") {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
// 添加网关
|
// 添加网关
|
||||||
name := m.Cmd("ssh._node", "create", node.Append("node.name"), "master", m.Cap("stream", nfs.Format("target")))
|
name := m.Cmd("ssh._node", "create", node.Append("node.name"), "master", m.Cap("stream", nfs.Format("target")))
|
||||||
|
|
||||||
|
@ -42,6 +42,9 @@ func Debugf(str string, args ...interface{}) {
|
|||||||
Log("debug", str, args...)
|
Log("debug", str, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Key(name string) string {
|
||||||
|
return strings.Replace(name, ".", "_", -1)
|
||||||
|
}
|
||||||
func Env(key string) {
|
func Env(key string) {
|
||||||
os.Getenv(key)
|
os.Getenv(key)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user