Command
Direct Subclass:
A command that can be run through the CLI.
Test:
Constructor Summary
Public Constructor | ||
public |
constructor(name: string, description: string, options: Object) Creates a new Command with the given name and options. |
Member Summary
Public Members | ||
public get |
The minimum and maximum number of (non-option) arguments the command handles. |
|
public |
The command descriptions. |
|
public |
The command's name. |
|
public get |
The options available for the command. |
|
public get |
If an error should be thrown for unknown arguments. |
|
public get |
Returns the usage string for the command. |
Private Members | ||
private |
The command's raw options. |
Method Summary
Public Methods | ||
public |
requiresEnvironment(cli: AtSCMCli): boolean Returns |
|
public |
Runs the command with the current Cli instance. |
Public Constructors
public constructor(name: string, description: string, options: Object) source
Creates a new Command with the given name and options.
Params:
Name | Type | Attribute | Description |
name | string | The command's name. |
|
description | string | The command's description. |
|
options | Object | The options to apply. |
|
options.options | Map<string, Option> | The options available for this command. |
|
options.arguments | string |
|
The command's argument string. See yargs' documentation for details. |
options.minArguments | number |
|
The minimum number or (non-option) arguments the command requires. |
options.maxArguments | number |
|
The maximum number or (non-option) arguments the command requires. |
options.strict | boolean |
|
Throw error for unknown arguments. |
Throw:
Throws an error if options.maxArguments is less than options.minArguments. |
Test:
See:
Public Members
public get demandCommand: number[] source
The minimum and maximum number of (non-option) arguments the command handles.
Test:
public get usage: string source
Returns the usage string for the command. Something like "{name} {arguments}".
Test:
Private Members
Public Methods
public requiresEnvironment(cli: AtSCMCli): boolean source
Returns true
if the command requires a Liftoff.Environment before it can be run.
Params:
Name | Type | Attribute | Description |
cli | AtSCMCli | The current cli instance. |