mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-08 14:34:13 +08:00
添加 closeWaitBtn
This commit is contained in:
parent
81147b02eb
commit
0f9f003c0a
@ -241,6 +241,8 @@ export default {
|
||||
if (!!this.child) {
|
||||
quickcommand.kill(this.child.pid);
|
||||
}
|
||||
quickcommand.closeWaitBtn?.();
|
||||
quickcommand.closeWaitBtn = () => {};
|
||||
if (!!this.listener) {
|
||||
this.subInputValue = "";
|
||||
utools.removeSubInput();
|
||||
|
@ -4,6 +4,7 @@
|
||||
seamless
|
||||
position="right"
|
||||
@hide="onDialogHide"
|
||||
style="z-index: 9999"
|
||||
>
|
||||
<q-card>
|
||||
<q-btn color="primary" :label="label" @click="onOKClick" v-close-popup />
|
||||
@ -16,8 +17,10 @@ export default {
|
||||
props: {
|
||||
label: String,
|
||||
},
|
||||
mounted(){
|
||||
console.log(this);
|
||||
mounted() {
|
||||
quickcommand.closeWaitBtn = () => {
|
||||
this.$refs?.dialog?.hide();
|
||||
};
|
||||
},
|
||||
emits: ["ok", "hide"],
|
||||
methods: {
|
||||
|
@ -1,15 +1,23 @@
|
||||
{
|
||||
"program": "quickcommand",
|
||||
"cmd": "const iconv = require('iconv-lite')\nconst child_process = require(\"child_process\")\nvar child = child_process.spawn(`{{subinput}}`, {shell: true, encoding: 'buffer'})\n\nchild.stdout.on('data', data => {\n var codec = utools.isWindows() ? 'cp936' : 'utf8'\n console.log(iconv.decode(data, codec))\n})\n\nchild.stderr.on('data', data => {\n var codec = utools.isWindows() ? 'cp936' : 'utf8'\n console.error(iconv.decode(data, codec))\n})",
|
||||
"cmd": "const iconv = require('iconv-lite')\nconst child_process = require(\"child_process\")\nvar child = child_process.spawn(`{{subinput}}`, {shell: true, encoding: 'buffer'})\n\nchild.stdout.on('data', data => {\n var codec = utools.isWindows() ? 'cp936' : 'utf8'\n console.log(iconv.decode(data, codec))\n})\n\nchild.stderr.on('data', data => {\n var codec = utools.isWindows() ? 'cp936' : 'utf8'\n console.error(iconv.decode(data, codec))\n})\n\nquickcommand.showWaitButton(()=>{\n quickcommand.kill(child.pid)\n}, \"中止命令\")",
|
||||
"scptarg": "",
|
||||
"features": {
|
||||
"explain": "执行 shell 命令",
|
||||
"platform": ["win32", "darwin", "linux"],
|
||||
"platform": [
|
||||
"win32",
|
||||
"darwin",
|
||||
"linux"
|
||||
],
|
||||
"icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAABmJLR0QA/wD/AP+gvaeTAAADTklEQVR4nO3cT0iTcRzH8c+zPz42VPIPudKQ0sprikjX6BIRRkRGKgkdhIESeOgQdAg6hCTMcIQEJsooE4sO0SG6VURERYeEDFKRZrGKqZtzj3s6VCJs5eaznu9jz+d1237Ps3153uz5MRgDiIiIiIiIiIjILpRsT3g98f4koPh1wPsvBtqsFCCUhN5ZV7tnLJvzHBt4K178NHTAq0Dpy/a8rAPw4v/V9mxP2MAngHLJZfQFkrqOj7MhzIW/A9DhLS1BVUU5HIqS0brdGQ4wNTuHmdCX1cfToc8AgF2V3ozW7c7wLSgU/pby3Kc1z623bnc52AP01BdVslm3N8MBvKUlKc9tKy3OeN3uDO8BVRXlAIBQ+CuAnxe8akd5xut2l/XN4NXEZOo9hVbtr63J6prye4AwBhDGAMIMb8LNp1tzMcemdTs4Yuh8fgKEMYAwBhDGAMIYQBgDCGMAYQwgjAGEMYAwBhDGAMIYQBgDCGMAYQwgjAGEiQWIBvqwUlMt9faWIRZAa2xANDiE2IXz0Evs+0Mt0VuQ7nQicfwY5sdHEW9vA/LckuOIsMYeUFiAeKcPC6NBJA4dlJ7GVNYI8EtyZyViVy4jOtCP5L690uOYQiyAx9cF5+SHtGtafR0WRgYRu3QRybIykyczl1gA1/MX8LS0I7+nF0okknqAw4HEkcNYvDuK5bPtZo9nGtFbkKJpyLt1BwVNJ6DeHAYSiZRjdM8WLPk6BKYzhyX2ACUyD/VaAAXNrXA/eiw9jqksEWAtXVWlRzCV4d+G5oJeVIjlM22It5wC3Pb6LiAaQHc6oTUdxZKvA3rx1rTHOKdnoPb6TZ7MPGIBtMYGxLvPYaV6d9p1JRZD3nAQ6uAQsJy6Of8vxAJEA3/4WwVdh/vBQ6j+fjjCYXOHEmCJPeA357sJqD29cL15u+6xkZfPcvreRfUHcvp6mbJEAEc4DPX6Dbjv3QeSSelxTCUaQNE0uMfGoQYGoCwuSo4iRiyA68lT5F/1wzE1LTWCJYgF8HR1Gzpf6p6da5b7Jmw3DCCMAYQxgDAGEMYAwhhAGAMIYwBhDCCMAYQxgDAGEMYAwhhAGAMIYwBh/OfcHOM/524yDCCMAYiIiIiIiIiIiEzyA97G0BQKex3zAAAAAElFTkSuQmCC",
|
||||
"code": "default_shellRunner",
|
||||
"cmds": ["sh"]
|
||||
"cmds": [
|
||||
"sh"
|
||||
]
|
||||
},
|
||||
"output": "text",
|
||||
"hasSubInput": true,
|
||||
"tags": ["默认"]
|
||||
}
|
||||
"tags": [
|
||||
"默认"
|
||||
]
|
||||
}
|
19
src/plugins/monaco/types/quickcommand.api.d.ts
vendored
19
src/plugins/monaco/types/quickcommand.api.d.ts
vendored
@ -157,8 +157,8 @@ interface quickcommandApi {
|
||||
* @param message 提示的内容
|
||||
* @param title 提示的标题
|
||||
*/
|
||||
showConfirmBox(message?: string, title?: string): Promise<boolean>;
|
||||
|
||||
showConfirmBox(message?: string, title?: string): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* 显示等待用户操作的按钮,用户点击后执行相关操作
|
||||
*
|
||||
@ -172,6 +172,11 @@ interface quickcommandApi {
|
||||
*/
|
||||
showWaitButton(callback, label?: string): void;
|
||||
|
||||
/**
|
||||
* 关掉现有等待操作按钮
|
||||
*/
|
||||
closeWaitBtn(): void;
|
||||
|
||||
/**
|
||||
* 同步等待,会阻塞进程
|
||||
* @param ms 等待的毫秒数
|
||||
@ -270,14 +275,18 @@ interface quickcommandApi {
|
||||
|
||||
/**
|
||||
* 将 signal 发送给 pid 标识的进程 , 默认为关闭进程
|
||||
*
|
||||
*
|
||||
* 不同于process.kill,会将该进程启用的所有子进程也杀死
|
||||
*
|
||||
*
|
||||
* @param pid 进程 ID
|
||||
* @param signal 进程信号,默认为SIGTERM
|
||||
* @param callback 失败时的回调
|
||||
*/
|
||||
kill(pid: number, signal?: string | number, callback?: (error?: Error) => void): void;
|
||||
kill(
|
||||
pid: number,
|
||||
signal?: string | number,
|
||||
callback?: (error?: Error) => void
|
||||
): void;
|
||||
|
||||
/**
|
||||
* windows 下运行 VBS 脚本并返回运行结果
|
||||
|
Loading…
x
Reference in New Issue
Block a user