BaseCommand
Constructors
new BaseCommand()
new BaseCommand(name?): BaseCommandParameters
| Parameter | Type | 
|---|---|
| 
 | 
 | 
Returns
Inherited from
_Command.constructorProperties
| Property | Modifier | Type | 
|---|---|---|
| 
 | 
Methods
autocomplete()
autocomplete(argv): BaseCommandParameters
| Parameter | Type | 
|---|---|
| 
 | 
 | 
Returns
autocompleteCandidates()
autocompleteCandidates(typedArgs): any[]Parameters
| Parameter | Type | 
|---|---|
| 
 | 
 | 
Returns
any[]
autocompleteHandleEvent()
autocompleteHandleEvent(event): voidParameters
| Parameter | Type | 
|---|---|
| 
 | 
 | 
Returns
void
autocompleteNormalizeRules()
autocompleteNormalizeRules(): NormalizedCompletionRulesReturns
complete()
complete(rules): BaseCommandParameters
| Parameter | Type | 
|---|---|
| 
 | 
 | 
Returns
getAutocompleteSubCommand()
getAutocompleteSubCommand(
   event, 
   elements, 
   commandName, 
   commandArgs): BaseCommandParameters
| Parameter | Type | 
|---|---|
| 
 | 
 | 
| 
 | 
 | 
| 
 | 
 | 
| 
 | 
 | 
Returns
hasCompletionRules()
hasCompletionRules(): booleanReturns
boolean
parse()
parse(argv?, parseOptions?): thisParse argv, setting options and invoking commands when defined.
Use parseAsync instead of parse if any of your action handlers are async.
Call with no parameters to parse process.argv. Detects Electron and special node options like node --eval. Easy mode!
Or call with an array of strings to parse, and optionally where the user arguments start by specifying where the arguments are from:
- 'node': default,- argv[0]is the application and- argv[1]is the script being run, with user arguments after that
- 'electron':- argv[0]is the application and- argv[1]varies depending on whether the electron application is packaged
- 'user': just user arguments
Parameters
| Parameter | Type | 
|---|---|
| 
 | readonly  | 
| 
 | 
 | 
Returns
this
this command for chaining
Example
program.parse(); // parse process.argv and auto-detect electron and special node flags
program.parse(process.argv); // assume argv[0] is app and argv[1] is script
program.parse(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]Overrides
_Command.parseparseAsync()
parseAsync(argv?, parseOptions?): Promise<BaseCommand>Parse argv, setting options and invoking commands when defined.
Call with no parameters to parse process.argv. Detects Electron and special node options like node --eval. Easy mode!
Or call with an array of strings to parse, and optionally where the user arguments start by specifying where the arguments are from:
- 'node': default,- argv[0]is the application and- argv[1]is the script being run, with user arguments after that
- 'electron':- argv[0]is the application and- argv[1]varies depending on whether the electron application is packaged
- 'user': just user arguments
Parameters
| Parameter | Type | 
|---|---|
| 
 | readonly  | 
| 
 | 
 | 
Returns
Promise<BaseCommand>
Promise
Example
await program.parseAsync(); // parse process.argv and auto-detect electron and special node flags
await program.parseAsync(process.argv); // assume argv[0] is app and argv[1] is script
await program.parseAsync(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]Overrides
_Command.parseAsync