mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-12-18 01:44:36 +08:00
新增quickcommand.runCode,quickcommand.runInTerminal支持warp
This commit is contained in:
@@ -159,7 +159,7 @@ export default {
|
||||
this.childProcess = window.runCodeFile(
|
||||
currentCommand.cmd,
|
||||
this.getCommandOpt(currentCommand),
|
||||
currentCommand.output === "terminal",
|
||||
currentCommand.output === "terminal" ? {} : false,
|
||||
(stdout, stderr) => this.handleResult(stdout, stderr, resultOpts)
|
||||
);
|
||||
this.listenStopSign();
|
||||
|
||||
@@ -36,6 +36,7 @@ import ButtonBox from "components/quickcommandUI/ButtonBox";
|
||||
import ConfirmBox from "components/quickcommandUI/ConfirmBox";
|
||||
import TextArea from "components/quickcommandUI/TextArea";
|
||||
import SelectList from "components/quickcommandUI/SelectList";
|
||||
import programs from "js/options/programs";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -256,8 +257,26 @@ export default {
|
||||
});
|
||||
},
|
||||
};
|
||||
// 将quickcommandUI添加到quickcommand
|
||||
Object.assign(window.quickcommand, quickcommandUI);
|
||||
|
||||
// 获取用户数据
|
||||
window.quickcommand.userData = this.$root.utools.userData;
|
||||
|
||||
// 添加runCode方法,不在preload中加是因为programs写在了src中-_-
|
||||
quickcommand.runCode = (code, program, runInTerminal = false) => {
|
||||
return new Promise((reslove, reject) => {
|
||||
window.runCodeFile(
|
||||
code,
|
||||
{ ...programs[program], charset: {}, scptarg: "" },
|
||||
runInTerminal,
|
||||
(result, err) => (err ? reject(err) : reslove(result))
|
||||
);
|
||||
false;
|
||||
});
|
||||
};
|
||||
|
||||
// 冻结quickcommand
|
||||
Object.freeze(quickcommand);
|
||||
},
|
||||
methods: {
|
||||
|
||||
Reference in New Issue
Block a user