diff --git a/packages/utils/package.json b/packages/utils/package.json index 947cb0f..3f662fa 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -42,6 +42,7 @@ }, "dependencies": { "ansi-colors": "^4.1.3", + "commander": "^12.1.0", "inquirer": "7", "qs": "^6.13.0" }, diff --git a/packages/utils/src/core/commander.ts b/packages/utils/src/core/commander.ts new file mode 100644 index 0000000..c5f35ca --- /dev/null +++ b/packages/utils/src/core/commander.ts @@ -0,0 +1,13 @@ +import { Command } from 'commander' + +/** + * 终端交互 + * 参考:https://www.npmjs.com/package/commander + */ +export class VipCommander extends Command { + constructor(name: string, version: string) { + super(name) + // 查看版本 + this.version(version, '-v --version', 'VipCommander Version By @142vip') + } +} diff --git a/packages/utils/src/core/index.ts b/packages/utils/src/core/index.ts index 8fd0fa4..592f68b 100644 --- a/packages/utils/src/core/index.ts +++ b/packages/utils/src/core/index.ts @@ -1,6 +1,7 @@ export * from './color' export * from './logger' export * from './exec' +export * from './commander' export * from './shell' export * from './inquirer' export * from './git' diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4d44a53..f61f621 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -349,6 +349,9 @@ importers: ansi-colors: specifier: ^4.1.3 version: 4.1.3 + commander: + specifier: ^12.1.0 + version: 12.1.0 inquirer: specifier: '7' version: 7.3.3