diff --git a/src/contexts/cli/version.go b/src/contexts/cli/version.go index df30ea5f..3662e510 100644 --- a/src/contexts/cli/version.go +++ b/src/contexts/cli/version.go @@ -7,5 +7,5 @@ var version = struct { self int }{ []string{"2017-11-01 01:02:03", "2019-07-13 18:02:21"}, - `2019-10-28 07:31:43`, `com`, 703, + `2019-10-28 17:53:02`, `centos`, 651, } diff --git a/src/contexts/ctx/core.go b/src/contexts/ctx/core.go index ae9ad5de..d1d2a719 100644 --- a/src/contexts/ctx/core.go +++ b/src/contexts/ctx/core.go @@ -32,6 +32,7 @@ func (c *Context) Register(s *Context, x Server, args ...interface{}) *Context { c.contexts[name] = s s.context = c s.Server = x + s.root = c.root return s } func (c *Context) Plugin(s *Context, args []string) string { diff --git a/src/plugin/mind/index.js b/src/plugin/mind/index.js index 61adfa50..97ab7841 100644 --- a/src/plugin/mind/index.js +++ b/src/plugin/mind/index.js @@ -26,7 +26,7 @@ Plugin["mind/index.js"] = function(field, option, output) {return { switch (event.key) { case "Enter": var s = td.parentNode[event.shiftKey?"previousSibling":"nextSibling"] - s? s.querySelector("td").click(): plugin.Runs(event) + s && s.querySelector("td").click() break case "Tab": if (event.shiftKey) { diff --git a/src/plugin/mind/index.shy b/src/plugin/mind/index.shy index ec3a5f5e..19e1b72e 100644 --- a/src/plugin/mind/index.shy +++ b/src/plugin/mind/index.shy @@ -5,3 +5,12 @@ kit xls "表格" "index.js" "index.css" private context find "web.wiki" xls \ button "返回" cb Last \ feature style "mind" \ exports xls_id id + +kit dir "目录" private "ssh._route" _ "nfs.dir" _ time size line path \ + text "" name pod imports plugin_pod action auto \ + text "usr/script" name dir imports plugin_dir action auto view long \ + button "浏览" action auto \ + button "返回" cb Last \ + feature display editor \ + exports dir "" dir + diff --git a/src/plugin/storage/index.shy b/src/plugin/storage/index.shy index 4e2012ba..4c2b7e1a 100644 --- a/src/plugin/storage/index.shy +++ b/src/plugin/storage/index.shy @@ -1,13 +1,33 @@ -fun clip "粘贴板" public \ + +fun buffer "粘贴板" private \ + text "0" name index imports plugin_tmux_bindex action auto \ + text "" name txt view long \ + button "查看" action auto \ + button "返回" cb Last \ + exports tmux_bindex cur + + if $1 == "" + copy cli.system tmux "list-buffer" cmd_parse cut 3 ":" "cur bytes text" + return + end + if $2 == "" + copy cli.system tmux "show-buffer" "-b" + return + end + copy cli.system tmux "set-buffer" "-b" +end + +fun clip "剪切板" public \ text "" name you imports plugin_you action auto \ + text "" name tag \ text "" name txt view long \ button "保存" action auto - if $2 == "" - copy ssh._route _ data show clip + if $3 == "" + copy skip ssh._route _ data show clip else - copy ssh._route _ data insert clip txt $2 + copy ssh._route _ data insert clip tag _ txt _ end end diff --git a/src/plugin/tmux/index.go b/src/plugin/tmux/index.go index e55bcaea..edd65871 100644 --- a/src/plugin/tmux/index.go +++ b/src/plugin/tmux/index.go @@ -174,6 +174,15 @@ var Index = &ctx.Context{Name: "tmux", Help: "终端管理", } switch arg[3] { + case "split": + ls := strings.Split(m.Cmdx("cli.system", "tmux", "capture-pane", "-t", target, "-p"), "\n") + for i := 1; i < len(ls)-1; i++ { + for j, v := range strings.Split(ls[i], " ") { + m.Push(kit.Format(j), v) + } + } + m.Table() + case "run": m.Cmd("cli.system", "tmux", "send-keys", "-t", target, "clear", "Enter") time.Sleep(kit.Duration(m.Conf("mux", "cmd_timeout"))) diff --git a/src/plugin/tmux/index.shy b/src/plugin/tmux/index.shy index 95fc607d..dd0367a2 100644 --- a/src/plugin/tmux/index.shy +++ b/src/plugin/tmux/index.shy @@ -48,6 +48,12 @@ kit cmd "命令" private mux _ _ _ r \ text "pwd" view full imports plugin_tmux_cmd \ button "执行" +kit list "内容" private mux _ _ _ split \ + text "context" imports plugin_tmux_sess \ + text "docker" imports plugin_tmux_wins \ + text "4" imports plugin_tmux_pane action auto view tiny \ + button "查看" + kit json "解析" private "nfs.json" \ text "" view full \ button "执行" diff --git a/usr/librarys/context.js b/usr/librarys/context.js index a407fb4e..d7931711 100644 --- a/usr/librarys/context.js +++ b/usr/librarys/context.js @@ -157,7 +157,7 @@ ctx = context = (function(kit) {var ctx = {__proto__: kit, xhr.send(args.join("&")) ++arguments.callee.meta.order }), - WSS: shy("响应后端", {order: 0, wssid: ""}, function(cb, onerror, onclose) {var meta = arguments.callee.meta + WSS: shy("响应后端", {order: 0, wssid: ""}, function(cb, onerror, onclose, onopen) {var meta = arguments.callee.meta var s = new WebSocket(location.protocol.replace("http", "ws")+"//"+location.host+"/wss?wssid="+meta.wssid) s.onopen = function(event) {kit.Tip("wss open"), ctx.Event(event, {}, {name: [document.title, "wss", "open"]})} s.onerror = function(event) {kit.Log("wss", "error", event), kit._call(onerror, [event])} diff --git a/usr/librarys/example.js b/usr/librarys/example.js index b6f3bcd6..eb95ab5b 100644 --- a/usr/librarys/example.js +++ b/usr/librarys/example.js @@ -347,7 +347,7 @@ function Page(page) { return kit._call(page[args[0]], args.slice(1)) || page.Zone("function", args[0]) } }), - WSS: function(cb, onerror, onclose) { + WSS: function(cb, onerror, onclose, onopen) { return page.socket || (page.socket = ctx.WSS(cb || (function(event, m) { if (m.detail) { page.action.Pane.Core(event, m, ["_cmd", m.detail], m.Reply) @@ -362,6 +362,7 @@ function Page(page) { delete(page.socket), setTimeout(function() { page.WSS(cb, onerror, onclose) }, 1000) + }), onopen || (function() { }))) }, @@ -1206,7 +1207,7 @@ function Plugin(page, pane, field, inits, runs) { var list = arguments.callee.list for (var i = 0; i < list.length; i += 3) { - (list[1] && line[list[1]] || list[i+1] && line[list[i+1]]) && + (list[1] && line[list[1]] || list[i+1] && line[list[i+1]] || list[i+2]) && page.Sync("plugin_"+list[i]).set(meta[list[i+2]||""](list[i+1]? line[list[i+1]]: value, list[i+1]||name, line, list)) } }), @@ -1281,7 +1282,19 @@ function Inputs(plugin, meta, item, target, option) { }) }), item.type == "button" && item.action == "auto" && target.click() }), + clear: function() { + target.value = "" + }, + onchoice: shy("菜单列表", { + "清空": "clear", + }, ["清空", "清空", "清空", "清空", "清空"], function(event, value, meta) { + kit._call(input, input[meta[value]]) + return true + }), onaction: shy("事件列表", { + oncontextmenu: function(event) { + plugin.oncarte(event, input.onchoice) + }, onfocus: function(event) {plugin.Select(target)}, onblur: function(event) {type == "text" && input.which.set(target.value)}, onclick: function(event) {plugin.Select()