mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-30 21:13:02 +08:00
「忽略输出且不隐藏 」不退出插件
This commit is contained in:
parent
b418815224
commit
700c3875c1
@ -134,17 +134,14 @@ export default {
|
|||||||
async fire(currentCommand) {
|
async fire(currentCommand) {
|
||||||
currentCommand.cmd = this.assignSpecialVars(currentCommand.cmd);
|
currentCommand.cmd = this.assignSpecialVars(currentCommand.cmd);
|
||||||
this.enableHtml = currentCommand.output === "html";
|
this.enableHtml = currentCommand.output === "html";
|
||||||
let { hideWindow, outPlugin, action } =
|
let { outPlugin, action } = outputTypes[currentCommand.output];
|
||||||
outputTypes[currentCommand.output];
|
let earlyExit = this.fromUtools && outPlugin;
|
||||||
// 需要隐藏的提前隐藏窗口
|
|
||||||
hideWindow && utools.hideMainWindow();
|
|
||||||
// 对于本身就没有输出的命令,无法确认命令是否执行完成,所以干脆提前退出插件
|
// 对于本身就没有输出的命令,无法确认命令是否执行完成,所以干脆提前退出插件
|
||||||
// 弊端就是如果勾选了隐藏后台就完全退出的话,会造成命令直接中断
|
// 弊端就是如果勾选了隐藏后台就完全退出的话,会造成命令直接中断
|
||||||
let earlyExit = this.fromUtools && outPlugin;
|
if (outPlugin) {
|
||||||
earlyExit &&
|
utools.hideMainWindow();
|
||||||
setTimeout(() => {
|
!earlyExit || setTimeout(utools.outPlugin, 500);
|
||||||
utools.outPlugin();
|
}
|
||||||
}, 500);
|
|
||||||
let resultOpts = { outPlugin, action, earlyExit };
|
let resultOpts = { outPlugin, action, earlyExit };
|
||||||
switch (currentCommand.program) {
|
switch (currentCommand.program) {
|
||||||
case "quickcommand":
|
case "quickcommand":
|
||||||
@ -268,9 +265,7 @@ export default {
|
|||||||
? alert(stderr)
|
? alert(stderr)
|
||||||
: this.showRunResult(stderr, false);
|
: this.showRunResult(stderr, false);
|
||||||
}
|
}
|
||||||
options.outPlugin
|
!options.action(stdout.toString()) || this.showRunResult(stdout, true);
|
||||||
? options.action(stdout.toString())
|
|
||||||
: this.showRunResult(stdout, true);
|
|
||||||
},
|
},
|
||||||
// 显示运行结果
|
// 显示运行结果
|
||||||
async showRunResult(content, isSuccess) {
|
async showRunResult(content, isSuccess) {
|
||||||
|
@ -7,7 +7,6 @@ const outputTypes = {
|
|||||||
name: "ignore",
|
name: "ignore",
|
||||||
label: "忽略输出并隐藏",
|
label: "忽略输出并隐藏",
|
||||||
icon: "more_horiz",
|
icon: "more_horiz",
|
||||||
hideWindow: true,
|
|
||||||
outPlugin: true,
|
outPlugin: true,
|
||||||
action: result => null
|
action: result => null
|
||||||
},
|
},
|
||||||
@ -15,26 +14,24 @@ const outputTypes = {
|
|||||||
name: "nothing",
|
name: "nothing",
|
||||||
label: "忽略输出且不隐藏",
|
label: "忽略输出且不隐藏",
|
||||||
icon: "blur_linear",
|
icon: "blur_linear",
|
||||||
outPlugin: true,
|
|
||||||
action: result => null
|
action: result => null
|
||||||
},
|
},
|
||||||
text: {
|
text: {
|
||||||
name: "text",
|
name: "text",
|
||||||
label: "纯文本输出",
|
label: "纯文本输出",
|
||||||
icon: "text_snippet",
|
icon: "text_snippet",
|
||||||
action: result => result
|
action: result => true
|
||||||
},
|
},
|
||||||
html: {
|
html: {
|
||||||
name: "html",
|
name: "html",
|
||||||
label: "html格式输出",
|
label: "html格式输出",
|
||||||
icon: "html",
|
icon: "html",
|
||||||
action: result => result
|
action: result => true
|
||||||
},
|
},
|
||||||
terminal: {
|
terminal: {
|
||||||
name: "terminal",
|
name: "terminal",
|
||||||
label: "在终端显示",
|
label: "在终端显示",
|
||||||
icon: "terminal",
|
icon: "terminal",
|
||||||
hideWindow: true,
|
|
||||||
outPlugin: true,
|
outPlugin: true,
|
||||||
action: result => null
|
action: result => null
|
||||||
|
|
||||||
@ -43,7 +40,6 @@ const outputTypes = {
|
|||||||
name: "clip",
|
name: "clip",
|
||||||
label: "复制到剪贴板",
|
label: "复制到剪贴板",
|
||||||
icon: "content_paste",
|
icon: "content_paste",
|
||||||
hideWindow: true,
|
|
||||||
outPlugin: true,
|
outPlugin: true,
|
||||||
action: result => window.copyTo(result)
|
action: result => window.copyTo(result)
|
||||||
},
|
},
|
||||||
@ -51,7 +47,6 @@ const outputTypes = {
|
|||||||
name: "send",
|
name: "send",
|
||||||
label: "发送到活动窗口",
|
label: "发送到活动窗口",
|
||||||
icon: "web_asset",
|
icon: "web_asset",
|
||||||
hideWindow: true,
|
|
||||||
outPlugin: true,
|
outPlugin: true,
|
||||||
action: result => window.send(result)
|
action: result => window.send(result)
|
||||||
},
|
},
|
||||||
@ -59,7 +54,6 @@ const outputTypes = {
|
|||||||
name: "notice",
|
name: "notice",
|
||||||
label: "发送系统通知",
|
label: "发送系统通知",
|
||||||
icon: "sms",
|
icon: "sms",
|
||||||
hideWindow: true,
|
|
||||||
outPlugin: true,
|
outPlugin: true,
|
||||||
action: result => window.message(result)
|
action: result => window.message(result)
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user