@cnbcool/cnb-api-generate 2.12.1 → 2.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client/index.ts
CHANGED
|
@@ -18,7 +18,7 @@ const program = new Command();
|
|
|
18
18
|
program
|
|
19
19
|
.name(process.env.CNB_CLI_CMD || 'cnb')
|
|
20
20
|
.description('CNB OpenAPI 命令行工具')
|
|
21
|
-
.version('<CNB_CLI_VERSION>', '
|
|
21
|
+
.version('<CNB_CLI_VERSION>', '--version', '显示版本号')
|
|
22
22
|
.allowUnknownOption()
|
|
23
23
|
.allowExcessArguments()
|
|
24
24
|
.helpOption('-h, --help', '显示帮助文档')
|
|
@@ -9,6 +9,11 @@ export function registerFallbackAction(program: Command): void {
|
|
|
9
9
|
.argument('[module]', '模块名称')
|
|
10
10
|
.argument('[tool]', '工具名称')
|
|
11
11
|
.action(async (moduleArg: string | undefined, toolArg: string | undefined, opts: Record<string, any>) => {
|
|
12
|
+
// 顶层 -v 打印版本号(不注册为 program option,避免覆盖子命令的 -v, --verbose)
|
|
13
|
+
if (moduleArg === '-v') {
|
|
14
|
+
console.log(program.version());
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
12
17
|
await executeAction(moduleArg, toolArg, opts, program);
|
|
13
18
|
});
|
|
14
19
|
}
|