(
isDefaultCommand: boolean,
commandHandler: CommandHandler,
innerYargs: YargsInstance,
parentCommands: string[],
commandIndex: number,
helpOnly: boolean
)
| 345 | ); |
| 346 | } |
| 347 | private parseAndUpdateUsage( |
| 348 | isDefaultCommand: boolean, |
| 349 | commandHandler: CommandHandler, |
| 350 | innerYargs: YargsInstance, |
| 351 | parentCommands: string[], |
| 352 | commandIndex: number, |
| 353 | helpOnly: boolean |
| 354 | ): |
| 355 | | {aliases: Dictionary<string[]>; innerArgv: Arguments} |
| 356 | | Promise<{aliases: Dictionary<string[]>; innerArgv: Arguments}> { |
| 357 | // A null command indicates we are running the default command, |
| 358 | // if this is the case, we should show the root usage instructions |
| 359 | // rather than the usage instructions for the nested default command: |
| 360 | if (isDefaultCommand) |
| 361 | innerYargs.getInternalMethods().getUsageInstance().unfreeze(true); |
| 362 | if (this.shouldUpdateUsage(innerYargs)) { |
| 363 | innerYargs |
| 364 | .getInternalMethods() |
| 365 | .getUsageInstance() |
| 366 | .usage( |
| 367 | this.usageFromParentCommandsCommandHandler( |
| 368 | parentCommands, |
| 369 | commandHandler |
| 370 | ), |
| 371 | commandHandler.description |
| 372 | ); |
| 373 | } |
| 374 | const innerArgv = innerYargs |
| 375 | .getInternalMethods() |
| 376 | .runYargsParserAndExecuteCommands( |
| 377 | null, |
| 378 | undefined, |
| 379 | true, |
| 380 | commandIndex, |
| 381 | helpOnly |
| 382 | ); |
| 383 | |
| 384 | return isPromise(innerArgv) |
| 385 | ? innerArgv.then(argv => ({ |
| 386 | aliases: (innerYargs.parsed as DetailedArguments).aliases, |
| 387 | innerArgv: argv, |
| 388 | })) |
| 389 | : { |
| 390 | aliases: (innerYargs.parsed as DetailedArguments).aliases, |
| 391 | innerArgv: innerArgv, |
| 392 | }; |
| 393 | } |
| 394 | private shouldUpdateUsage(yargs: YargsInstance) { |
| 395 | return ( |
| 396 | !yargs.getInternalMethods().getUsageInstance().getUsageDisabled() && |
no test coverage detected