From 25d799a693449af45e3e3f4be955dc2dee5a5f12 Mon Sep 17 00:00:00 2001 From: shaoying Date: Thu, 12 Aug 2021 08:47:20 +0800 Subject: [PATCH] opt golang --- plugin/local/code/snippet.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 plugin/local/code/snippet.js diff --git a/plugin/local/code/snippet.js b/plugin/local/code/snippet.js new file mode 100644 index 00000000..99ddfe91 --- /dev/null +++ b/plugin/local/code/snippet.js @@ -0,0 +1,32 @@ +Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg, list, cb, target) { + can.onmotion.clear(can) + if (msg.Option("content")) { + can.onappend.plugins(can, {index: "web.code.vimer"}, function(sub) { + sub.run = function(event, cmds, cb) { var res = can.request(event) + if (cmds[1] == "plugin") { + can.run(event, ["action", "vimer"].concat(cmds), cb, true) + return + } + if (cmds[1] == "main.go") { res.Echo(msg.Option("content")) + can.core.Timer(100, function() { can.sub && can.sub.onaction["项目"]({}, can.sub) }) + } + cb(res), can.sub = can.core.Value(sub, "_outputs.-1") + } + }, can._output) + return + } + can.onappend.table(can, msg) + can.onappend.board(can, msg) + }, +}) +Volcanos("onaction", {help: "操作数据", list: [], _init: function(can, msg, list, cb, target) { + }, + run: function(event, can, msg) { + can.run(event, [ctx.ACTION, cli.RUN, "go", "hi.go", can.sub.onexport.content(can.sub)], function(msg) { + can.onappend.board(can, msg) + }, true) + }, +}) +Volcanos("onexport", {help: "导出数据", list: [], _init: function(can, msg, list, cb, target) { +}}) +