Comparing version 1.0.32 to 1.0.33
25
cli.js
@@ -18,10 +18,25 @@ #!/usr/bin/env node | ||
.name("xiakebot-cli") | ||
.option('-r, --run', "在机器人上运行目录下的module.ts") | ||
.helpOption('-h, --help', "获取帮助信息") | ||
.version(package_info.version, "-v, --version", "获取版本信息"); | ||
.option('-k, --key [key]', '你的机器人key') | ||
.option('-t, --token [token]', '你的用户token') | ||
.option('-u, --upload', "将策略上传到机器人") | ||
.option('-p, --publish', "将策略正式发布到平台") | ||
.helpOption('-h, --help', "帮助信息") | ||
.version(package_info.version, "-v, --version", "版本信息"); | ||
program.parse(process.argv); | ||
(() => __awaiter(void 0, void 0, void 0, function* () { | ||
if (program.run) { | ||
console.log("哈哈"); | ||
const options = program.opts(); | ||
if (options.upload) { | ||
if (!options.key) { | ||
console.error("缺少key参数!"); | ||
} | ||
if (!options.token) { | ||
console.error("缺少token参数!"); | ||
} | ||
if (!options.key || !options.token) { | ||
return; | ||
} | ||
} | ||
else { | ||
program.help(); | ||
} | ||
return 0; | ||
@@ -28,0 +43,0 @@ }))().catch(e => { |
29
cli.ts
@@ -11,7 +11,10 @@ #!/usr/bin/env node | ||
.name("xiakebot-cli") | ||
.option('-r, --run', "在机器人上运行目录下的module.ts") | ||
.helpOption('-h, --help', "获取帮助信息") | ||
.version(package_info.version, "-v, --version", "获取版本信息") | ||
// .option('-h, --help',"显示帮助命令") | ||
.option('-k, --key [key]', '你的机器人key') | ||
.option('-t, --token [token]', '你的用户token') | ||
.option('-u, --upload', "将策略上传到机器人") | ||
.option('-p, --publish', "将策略正式发布到平台") | ||
.helpOption('-h, --help', "帮助信息") | ||
.version(package_info.version, "-v, --version", "版本信息") | ||
//解析传入参数 | ||
@@ -22,5 +25,19 @@ program.parse(process.argv); | ||
(async () => { | ||
if (program.run) { | ||
console.log("哈哈"); | ||
const options = program.opts(); | ||
if (options.upload) { | ||
if (!options.key) { | ||
console.error("缺少key参数!"); | ||
} | ||
if (!options.token) { | ||
console.error("缺少token参数!"); | ||
} | ||
if (!options.key || !options.token) { | ||
return; | ||
} | ||
} else { | ||
program.help(); | ||
} | ||
return 0; | ||
@@ -27,0 +44,0 @@ })().catch(e => { |
@@ -16,2 +16,6 @@ export class bot { | ||
export interface option { | ||
getOption: () => Promise<object>; | ||
} | ||
{ | ||
"name": "xiakebot", | ||
"version": "1.0.32", | ||
"version": "1.0.33", | ||
"description": "xiakebot", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4997
141