mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-30 21:13:02 +08:00
去掉调试时的 console 语句
This commit is contained in:
parent
eb0f17bd9a
commit
3fa216bdd8
@ -246,7 +246,6 @@ let getCommandToLaunchTerminal = (cmdline, dir) => {
|
|||||||
end tell'`;
|
end tell'`;
|
||||||
|
|
||||||
}
|
}
|
||||||
console.log(command);
|
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,7 +401,6 @@ window.getSelectFile = hwnd => {
|
|||||||
encoding: "utf8",
|
encoding: "utf8",
|
||||||
windowsHide: true
|
windowsHide: true
|
||||||
})
|
})
|
||||||
console.log(result);
|
|
||||||
return result ? result.trim() : ""
|
return result ? result.trim() : ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -474,7 +472,7 @@ window.runCodeInSandbox = (code, callback, addVars = {}) => {
|
|||||||
let sandbox = getSandboxFuns()
|
let sandbox = getSandboxFuns()
|
||||||
sandbox.console = {
|
sandbox.console = {
|
||||||
log: (...stdout) => {
|
log: (...stdout) => {
|
||||||
console.log(stdout);
|
console.log("Result:", stdout);
|
||||||
callback(stdout, null)
|
callback(stdout, null)
|
||||||
},
|
},
|
||||||
error: (...stderr) => {
|
error: (...stderr) => {
|
||||||
@ -526,7 +524,7 @@ window.runCodeFile = (cmd, option, terminal, callback) => {
|
|||||||
charset = option.charset,
|
charset = option.charset,
|
||||||
scptarg = option.scptarg || "";
|
scptarg = option.scptarg || "";
|
||||||
let script = getQuickcommandTempFile(ext, 'quickcommandTempScript')
|
let script = getQuickcommandTempFile(ext, 'quickcommandTempScript')
|
||||||
// 批处理和 powershell 默认编码为 GBK, 解决批处理的换行问题
|
// 批处理和 powershell 默认编码为 GBK, 解决批处理的换行问题
|
||||||
if (charset.scriptCode) cmd = iconv.encode(cmd.replace(/\n/g, '\r\n'), charset.scriptCode);
|
if (charset.scriptCode) cmd = iconv.encode(cmd.replace(/\n/g, '\r\n'), charset.scriptCode);
|
||||||
fs.writeFileSync(script, cmd);
|
fs.writeFileSync(script, cmd);
|
||||||
// var argvs = [script]
|
// var argvs = [script]
|
||||||
@ -548,27 +546,27 @@ window.runCodeFile = (cmd, option, terminal, callback) => {
|
|||||||
// 在终端中输出
|
// 在终端中输出
|
||||||
if (terminal) cmdline = getCommandToLaunchTerminal(cmdline)
|
if (terminal) cmdline = getCommandToLaunchTerminal(cmdline)
|
||||||
child = child_process.spawn(cmdline, {
|
child = child_process.spawn(cmdline, {
|
||||||
encoding: 'buffer',
|
encoding: 'buffer',
|
||||||
shell: true
|
shell: true
|
||||||
})
|
})
|
||||||
// var chunks = [],
|
// var chunks = [],
|
||||||
// err_chunks = [];
|
// err_chunks = [];
|
||||||
console.log('running: ' + cmdline);
|
console.log('Running: ' + cmdline);
|
||||||
child.stdout.on('data', chunk => {
|
child.stdout.on('data', chunk => {
|
||||||
if (charset.outputCode) chunk = iconv.decode(chunk, charset.outputCode)
|
if (charset.outputCode) chunk = iconv.decode(chunk, charset.outputCode)
|
||||||
callback(chunk.toString(), null)
|
callback(chunk.toString(), null)
|
||||||
// chunks.push(chunk)
|
// chunks.push(chunk)
|
||||||
})
|
})
|
||||||
child.stderr.on('data', stderr => {
|
child.stderr.on('data', stderr => {
|
||||||
if (charset.outputCode) stderr = iconv.decode(stderr, charset.outputCode)
|
if (charset.outputCode) stderr = iconv.decode(stderr, charset.outputCode)
|
||||||
callback(null, stderr.toString())
|
callback(null, stderr.toString())
|
||||||
// err_chunks.push(err_chunk)
|
// err_chunks.push(err_chunk)
|
||||||
})
|
})
|
||||||
// child.on('close', code => {
|
// child.on('close', code => {
|
||||||
// let stdout = chunks.join("");
|
// let stdout = chunks.join("");
|
||||||
// let stderr = err_chunks.join("");
|
// let stderr = err_chunks.join("");
|
||||||
// callback(stdout, stderr)
|
// callback(stdout, stderr)
|
||||||
// })
|
// })
|
||||||
return child
|
return child
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -606,7 +604,7 @@ window.quickcommandHttpServer = () => {
|
|||||||
req.on('end', () => {
|
req.on('end', () => {
|
||||||
let parsedParams
|
let parsedParams
|
||||||
let params = data.join("").toString()
|
let params = data.join("").toString()
|
||||||
// 先尝试作为 json 解析
|
// 先尝试作为 json 解析
|
||||||
try {
|
try {
|
||||||
parsedParams = JSON.parse(params)
|
parsedParams = JSON.parse(params)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -620,7 +618,7 @@ window.quickcommandHttpServer = () => {
|
|||||||
})
|
})
|
||||||
httpServer.listen(port, 'localhost');
|
httpServer.listen(port, 'localhost');
|
||||||
httpServer.on('error', err => {
|
httpServer.on('error', err => {
|
||||||
console.log(err)
|
console.log('httpErr:', err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
let stop = () => {
|
let stop = () => {
|
||||||
|
@ -330,9 +330,6 @@ export default {
|
|||||||
isCommandActivated: Boolean,
|
isCommandActivated: Boolean,
|
||||||
cardStyle: Object,
|
cardStyle: Object,
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
// console.log(this.commandInfo.features.code, this);
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
// 匹配类型太长的话截断
|
// 匹配类型太长的话截断
|
||||||
getShortStrByByte(str) {
|
getShortStrByByte(str) {
|
||||||
|
@ -380,7 +380,6 @@ export default {
|
|||||||
},
|
},
|
||||||
// 正则不和规则自动加斜杠
|
// 正则不和规则自动加斜杠
|
||||||
regexVerify() {
|
regexVerify() {
|
||||||
console.log(1);
|
|
||||||
if (
|
if (
|
||||||
this.cmdType.valueType === "regex" &&
|
this.cmdType.valueType === "regex" &&
|
||||||
!/^\/.*?\/[igm]*$/.test(this.cmdMatch)
|
!/^\/.*?\/[igm]*$/.test(this.cmdMatch)
|
||||||
|
@ -76,7 +76,6 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.frameInit();
|
this.frameInit();
|
||||||
console.log(this.runResult);
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
frameInit() {
|
frameInit() {
|
||||||
|
@ -179,7 +179,7 @@ export default {
|
|||||||
)
|
)
|
||||||
: 1;
|
: 1;
|
||||||
this.$root.utools.whole.fetchUserPayments().then((ret) => {
|
this.$root.utools.whole.fetchUserPayments().then((ret) => {
|
||||||
console.log(ret);
|
console.log("PayInfo:", ret);
|
||||||
!ret.filter((x) => x.goods_id === this.goodsId).length ||
|
!ret.filter((x) => x.goods_id === this.goodsId).length ||
|
||||||
(this.isPluginVIP = true);
|
(this.isPluginVIP = true);
|
||||||
});
|
});
|
||||||
|
@ -151,7 +151,6 @@ const specialVars = {
|
|||||||
desc: "用户设置的变量",
|
desc: "用户设置的变量",
|
||||||
match: /{{usr:(.*?)}}/mg,
|
match: /{{usr:(.*?)}}/mg,
|
||||||
repl: (text, userData) => {
|
repl: (text, userData) => {
|
||||||
console.log(userData);
|
|
||||||
let filterd = userData.filter(x => x.id === text.slice(6, -2))
|
let filterd = userData.filter(x => x.id === text.slice(6, -2))
|
||||||
return filterd.length ? filterd[0].value : ''
|
return filterd.length ? filterd[0].value : ''
|
||||||
},
|
},
|
||||||
@ -159,4 +158,4 @@ const specialVars = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default specialVars
|
export default specialVars
|
||||||
|
@ -150,7 +150,6 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
window.yuQueClient(`repos/${this.releaseRepo}/docs`).then((res) => {
|
window.yuQueClient(`repos/${this.releaseRepo}/docs`).then((res) => {
|
||||||
console.log(res.data);
|
|
||||||
this.allCommands = res.data.data;
|
this.allCommands = res.data.data;
|
||||||
this.matchedCommands = _.cloneDeep(this.allCommands);
|
this.matchedCommands = _.cloneDeep(this.allCommands);
|
||||||
this.fetchCommandDetails(1);
|
this.fetchCommandDetails(1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user