Skip to content

Commit

Permalink
TypeScript for addHelpCommand (#1375)
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowspawn committed Oct 19, 2020
1 parent f15900d commit 2935568
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions typings/commander-tests.ts
Expand Up @@ -55,6 +55,13 @@ const addCommandThis: commander.Command = program.addCommand(new commander.Comma
// arguments
const argumentsThis: commander.Command = program.arguments('<cmd> [env]');

// addHelpCommand
const addHelpCommandThis1: commander.Command = program.addHelpCommand();
const addHelpCommandThis3: commander.Command = program.addHelpCommand(false);
const addHelpCommandThis2: commander.Command = program.addHelpCommand(true);
const addHelpCommandThis4: commander.Command = program.addHelpCommand('compress <file>');
const addHelpCommandThis5: commander.Command = program.addHelpCommand('compress <file>', 'compress target file');

// exitOverride
const exitThis1: commander.Command = program.exitOverride();
const exitThis2: commander.Command = program.exitOverride((err): never => {
Expand Down
11 changes: 11 additions & 0 deletions typings/index.d.ts
Expand Up @@ -109,6 +109,17 @@ declare namespace commander {
*/
arguments(desc: string): this;

/**
* Override default decision whether to add implicit help command.
*
* addHelpCommand() // force on
* addHelpCommand(false); // force off
* addHelpCommand('help [cmd]', 'display help for [cmd]'); // force on with custom details
*
* @returns `this` command for chaining
*/
addHelpCommand(enableOrNameAndArgs?: string | boolean, description?: string): this;

/**
* Register callback to use as replacement for calling process.exit.
*/
Expand Down

0 comments on commit 2935568

Please sign in to comment.