Option
Defines options with short and long names.
Options can also have optional or required arguments.
Test:
Constructor Summary
Public Constructor | ||
public |
constructor(config: string | object, description: string, defaultValue: *): Option Creates a new Option. |
Method Summary
Public Methods | ||
public |
debug() Prints out debugging information. |
|
public |
Gets a property of the Option instance. |
|
public |
getArgValue(args: Immutable.List): mixed Returns the argument value for this option, according to a list of args. |
Public Constructors
public constructor(config: string | object, description: string, defaultValue: *): Option source
Creates a new Option.
Option strings can have a short and long name, as well as a named argument, which can be optional or required. It's defined as a string:
-o --long-option [argumentName]
where:
-o
represents the short name (o),--long-option
is the long name (long-option
)- and
[argumentName]
represents an optional argument. - use
<argumentName>
for required arguments.
Test:
Public Methods
public get(key: string): * source
Gets a property of the Option instance.
Params:
Name | Type | Attribute | Description |
key | string | The name of the property to get. |
Return:
* | The value of the property. |
public getArgValue(args: Immutable.List): mixed source
Returns the argument value for this option, according to a list of args.
Params:
Name | Type | Attribute | Description |
args | Immutable.List | List of arguments. |
Return:
mixed (nullable: true) | The value of the argument. |