remote 命令

This commit is contained in:
Cheney 2025-03-13 15:27:23 +08:00
parent 37af0bd7a6
commit d05bb4cfe6
3 changed files with 8 additions and 5 deletions

View File

@ -1,6 +1,5 @@
const config = require('./config') const config = require('./config')
const Context = require("./context") const Context = require("./context")
const log4js = require("log4js");
// const layout = log4js.layouts.patternLayout('%m') // const layout = log4js.layouts.patternLayout('%m')
if ( ! global.$inited ) { if ( ! global.$inited ) {
init() init()

View File

@ -10,16 +10,19 @@ module.exports = {
parser.addCmdLine("help", "打开在线帮助;", async function () { parser.addCmdLine("help", "打开在线帮助;", async function () {
const uConfig = await $context.get("uConfig") const uConfig = await $context.get("uConfig")
shell.execSync("start " + uConfig.get("man")) if (os.type() === 'Windows_NT') {
shell.execSync("start " + uConfig.get("man"))
} else {
console.log("请用浏览器访问 " + uConfig.get("man"))
}
}); });
parser.addCmdLine("manu", "人工维护配置;", function () { parser.addCmdLine("manu", "人工维护配置;", function () {
if (os.type() === 'Windows_NT') { if (os.type() === 'Windows_NT') {
shell.execSync("start " + $sConfig.getUserConfigPath()) shell.execSync("start " + $sConfig.getUserConfigPath())
} else { } else {
console.log("请用浏览器访问:" + $sConfig.getUserConfigPath()) console.log("cd " + $sConfig.getUserConfigPath())
} }
}); });
parser.addCmdLine("run [--file] [func]", "运行项目脚本;", function (cli) { parser.addCmdLine("run [--file] [func]", "运行项目脚本;", function (cli) {
$logger.info("kit 当前执行目录 " + process.cwd()); $logger.info("kit 当前执行目录 " + process.cwd());
const fs = require("fs"); const fs = require("fs");
@ -77,7 +80,7 @@ async function main(){
} }
}); });
parser.addCmdLine("remote-check", "验证远程仓库;", async function () { parser.addCmdLine("remote", "验证远程仓库;", async function () {
let remote = await $context.get("remote") let remote = await $context.get("remote")
if (!(await remote.check())) { if (!(await remote.check())) {
$logger.error("远程仓库不可用") $logger.error("远程仓库不可用")

View File

@ -79,6 +79,7 @@ module.exports = class Remote {
return true return true
}catch ( e ) { }catch ( e ) {
$logger.error("remote check 过程中出错", e) $logger.error("remote check 过程中出错", e)
console.error(e)
return false return false
} }
} }