Functions
action( fn: (...args: any[]) => any ) : Command
Defined in commander.d.ts:133
Register callback fn for the command.
Parameters
fn: (...args: any[]) => any
Returns
Command
choose( options: Array<string> , callback: (idx: number) => any )
Defined in commander.d.ts:209
Prompt for password with str, mask char and callback fn(val).
The mask string defaults to '', aka no output is written while typing, you may want to use "*" etc.
Parameters
options: Array<string>
callback: (idx: number) => any
choose( options: Array<any> , callback: (idx: number) => any )
Defined in commander.d.ts:210
Parameters
options: Array<any>
callback: (idx: number) => any
command( name: string ) : Command
Defined in commander.d.ts:226
Add command with the specified name. Returns a new instance of Command.
The .action() callback is invoked when the
command name is specified via ARGV,
and the remaining arguments are applied to the
function for access.
When the name is "*" an un-matched command
will be passed as the first arg, followed by
the rest of ARGV remaining.
Parameters
Returns
Command
confirm( label: string , callback: (flag: boolean) => any )
Defined in commander.d.ts:203
Prompts the user for a confirmation.
Parameters
label: string
callback: (flag: boolean) => any
description( description: string ) : Command
Defined in commander.d.ts:168
Gets or sets the command description.
Parameters
Returns
Command
description( ) : string
Defined in commander.d.ts:169
Returns
string
option( flags: string , description: string , coerceFn?: (value: string) => any , defaultValue?: any ) : Command
Defined in commander.d.ts:150
Define option with flags, description and optional coercion function and default value.
The flags string should contain both the short and long flags
separated by comma, a pipe or space. The following are all valid
all will output this way when --help is used.
"-p, --pepper"
"-p|--pepper"
"-p --pepper"
Parameters
flags: string
the option flags.
description: string
the option description. The description is printed when "--help" is used.
coerceFn?: (value: string) => any optional
(optional) specifies a callback function to coerce the option arg.
defaultValue?: any optional
(optional) specifies a default value.
Returns
Command
parse( argv: Array<string> ) : Command
Defined in commander.d.ts:162
Parse the arguments array and invokes the commands passing the parsed options.
Parameters
argv: Array<string>
the arguments array.
Returns
Command
password( label: string , mask: string , callback: (value: string) => any )
Defined in commander.d.ts:197
Prompt for password with a label, a optional mask char and callback function.
The mask string defaults to '', aka no output is written while typing, you may want to use "*" etc.
Parameters
label: string
mask: string
callback: (value: string) => any
password( label: string , callback: (value: string) => any )
Defined in commander.d.ts:198
Parameters
label: string
callback: (value: string) => any
prompt( label: string , callback: (value: string) => any )
Defined in commander.d.ts:187
Parameters
label: string
callback: (value: string) => any
promptForDate( label: string , callback: (value: Date) => any )
Defined in commander.d.ts:190
Parameters
label: string
callback: (value: Date) => any
promptForNumber( label: string , callback: (value: number) => any )
Defined in commander.d.ts:189
Parameters
label: string
callback: (value: number) => any
promptMultiLine( label: string , callback: (value: string) => any )
Defined in commander.d.ts:192
Parameters
label: string
callback: (value: string) => any
promptSingleLine( label: string , callback: (value: string) => any )
Defined in commander.d.ts:191
Parameters
label: string
callback: (value: string) => any
usage( usage: string ) : Command
Defined in commander.d.ts:174
Gets or sets the usage help string.
Parameters
Returns
Command
usage( ) : string
Defined in commander.d.ts:175
Returns
string
version( version: string ) : Command
Defined in commander.d.ts:156
Sets the command version
Parameters
Returns
Command