Static Method Summary
Static Public Methods | ||
public static |
setDebugLevel(level: int) Sets the debug level for which messages will be printed. |
Constructor Summary
Public Constructor | ||
public |
constructor(config: string | object | Commando): Commando Create a Commando from a string, object or Commando. |
Method Summary
Public Methods | ||
public |
Returns a commando with a new action added to it. |
|
public |
Returns a Command with arguments applied to it. |
|
public |
Returns a commando with a before callback set to 'before'. |
|
public |
Returns a commando with a new subcommand added to it. |
|
public |
debug() Prints out debugging information. |
|
public |
description(description: string): Commando Returns a new Commando with the same config and a given description. |
|
public |
Gets a property of the Commando instance. |
|
public |
getCommand(name: string): Commando | undefined Gets a sub command by name. |
|
public |
Returns the value for an applied option. |
|
public |
Returns an object with option names as keys and option values as values. |
|
public |
help() Prints user facing command help. |
|
public |
Returns a new Commando with the same config and a given name. |
|
public |
Returns a commando with a new option added to it. |
|
public |
Runs the command based on previously set arguments. |
|
public |
Returns a new Commando with the same config and a given version number. |
Static Public Methods
public static setDebugLevel(level: int) source
Sets the debug level for which messages will be printed.
Params:
Name | Type | Attribute | Description |
level | int | the debug level |
See:
- option.js
Public Constructors
Public Methods
public action(action: function): Commando source
Returns a commando with a new action added to it.
Params:
Name | Type | Attribute | Description |
action | function | An action callback for this command. |
Test:
public args(args: array, rootArgs: Immutable.Map): Commando source
Returns a Command with arguments applied to it.
Params:
Name | Type | Attribute | Description |
args | array | Arguments array. Usually they will be process.argv.slice([2]). |
|
rootArgs | Immutable.Map |
|
Arguments of the root command. |
Test:
public before(before: Commando): Commando source
Returns a commando with a before callback set to 'before'.
Params:
Name | Type | Attribute | Description |
before | Commando | A sub command to add to the current instance. |
public command(command: Commando): Commando source
Returns a commando with a new subcommand added to it.
Params:
Name | Type | Attribute | Description |
command | Commando | A sub command to add to the current instance. |
public description(description: string): Commando source
Returns a new Commando with the same config and a given description.
Params:
Name | Type | Attribute | Description |
description | string | A description string. |
public get(key: string): * source
Gets a property of the Commando instance.
Params:
Name | Type | Attribute | Description |
key | string | The name of the property to get. |
Return:
* | The value of the property. |
public getCommand(name: string): Commando | undefined source
Gets a sub command by name.
Params:
Name | Type | Attribute | Description |
name | string | The name of the desired sub command. |
Test:
public getOption(key: string): string source
Returns the value for an applied option.
Params:
Name | Type | Attribute | Description |
key | string | the option key (short, long, or key) |
public getOptionsHash(): object source
Returns an object with option names as keys and option values as values.
public name(name: string): Commando source
Returns a new Commando with the same config and a given name.
Params:
Name | Type | Attribute | Description |
name | string | A name string. |
public option(optstring: string, description: string, defaultValue: *): Commando source
Returns a commando with a new option added to it.