@zhennann/common-bin 2.9.6 → 2.9.9

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.
Files changed (2) hide show
  1. package/lib/command.js +16 -8
  2. package/package.json +1 -1
package/lib/command.js CHANGED
@@ -205,15 +205,19 @@ class CommonBin {
205
205
  */
206
206
  * [DISPATCH]() {
207
207
  // define --help and --version by default
208
- this.yargs
208
+ const _yargs = this.yargs
209
209
  // .reset()
210
- .completion(null, false)
210
+ .completion('completion', false)
211
211
  .help()
212
212
  .version()
213
213
  .wrap(80)
214
214
  .alias('h', 'help')
215
- .alias('v', 'version')
216
- .group([ 'help', 'version' ], 'Global Options:');
215
+ .alias('v', 'version');
216
+ if (this.constructor.name === 'CliCommand') {
217
+ _yargs.alias('t', 'token').group(['help', 'version', 'token'], 'Global Options:');
218
+ } else {
219
+ _yargs.group(['help', 'version'], 'Global Options:');
220
+ }
217
221
 
218
222
  // get parsed argument without handling helper and version
219
223
  const parsed = yield this[PARSE](this.rawArgv);
@@ -271,10 +275,14 @@ class CommonBin {
271
275
  rawArgv: this.rawArgv,
272
276
  };
273
277
 
274
- argv.help = undefined;
275
- argv.h = undefined;
276
- argv.version = undefined;
277
- argv.v = undefined;
278
+ delete argv.help;
279
+ delete argv.h;
280
+ delete argv.version;
281
+ delete argv.v;
282
+ // argv.help = undefined;
283
+ // argv.h = undefined;
284
+ // argv.version = undefined;
285
+ // argv.v = undefined;
278
286
 
279
287
  // remove alias result
280
288
  if (this.parserOptions.removeAlias) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhennann/common-bin",
3
- "version": "2.9.6",
3
+ "version": "2.9.9",
4
4
  "description": "Abstraction bin tool",
5
5
  "main": "index.js",
6
6
  "dependencies": {