Constructor
new FlagOption(long_flag, short_flag, message, argument_description)
Instantiate the option.
Name | Type | Default | Description |
---|---|---|---|
long_flag |
string | boolean | false | the name of the long flag (e.g. '--long'), false to disable |
short_flag |
string | boolean | false | the name of the short flag (e.g. '-f'), false to disable |
message |
string | boolean | false | help message, false to disable |
argument_description |
string | boolean | false | argument description, false to disable |
- Source:
Extends
Members
(private) _blacklist :Array.<*>
Blacklisted values.
- Array.<*>
- Source:
(private) _equality_value :*
The value to be used to check equality.
- *
- Source:
(private) _greater_than_bit :boolean
If true, the greater than will be greater than or equal to.
- boolean
- Source:
(private) _greater_than_value :*
Value to be compared in greater than.
- *
- Source:
(private) _less_than_bit :boolean
If true, the less than will be less than or equal to.
- boolean
- Source:
(private) _less_than_value :*
Value to be compared in less than.
- *
- Source:
(private) _optional :boolean
Is this option optional?
- boolean
- Source:
(private) _use_blacklist :boolean
Do we use the blacklist?
- boolean
- Source:
(private) _use_equality :boolean
Do we use the equality operator?
- boolean
- Source:
(private) _use_greater_than :boolean
Do we use the greater-than comparison?
- boolean
- Source:
(private) _use_less_than :boolean
Do we use the less-than comparison?
- boolean
- Source:
(private) _use_whitelist :boolean
Do we use the whitelist?
- boolean
- Source:
(private) _whitelist :Array.<*>
Whitelisted values.
- Array.<*>
- Source:
argument_description :string|boolean
The argument description.
- string | boolean
- Source:
argument_name
Get the referential name for this option. Defaults to the long flag (without the '--'). If this cannot be found, the short flag (without the '-') is used.
- Source:
long_flag :string|boolean
The long flag for this option. e.g. '--long'
- string | boolean
- Source:
message :string|boolean
The help message.
- string | boolean
- Source:
requirement_displays
Get an array of strings denoting the human-readable requirements for this option to be valid.
- Source:
short_flag :string|boolean
The short flag for this option. e.g. '-l'
- string | boolean
- Source:
Methods
blacklist(…items)
Blacklist the specified item or items and enable the blacklist.
Name | Type | Attributes | Description |
---|---|---|---|
items |
* |
<repeatable> |
the items to blacklist |
- Source:
equals(value)
Specifies the value to be used in equality comparison and enables that comparison.
Name | Type | Description |
---|---|---|
value |
* |
- Source:
greater_than(value)
Specifies the value to be used in greater-than comparison and enables that comparison.
Name | Type | Description |
---|---|---|
value |
* |
- Source:
greater_than_equal_to(value)
Specifies the value to be used in greater-than or equal-to comparison and enables that comparison.
Name | Type | Description |
---|---|---|
value |
* |
- Source:
less_than(value)
Specifies the value to be used in less-than comparison and enables less-than comparison.
Name | Type | Description |
---|---|---|
value |
* |
- Source:
less_than_equal_to(value)
Specifies the value to be used in less-than or equal-to comparison and enables that comparison.
Name | Type | Description |
---|---|---|
value |
* |
- Source:
optional()
Sets the Option as optional.
- Source:
validate(value) → {boolean}
Checks if the specified value passes the configured comparisons.
Name | Type | Description |
---|---|---|
value |
* |
- Source:
- Type
- boolean
whitelist(…items)
Whitelist the specified item or items and enable the whitelist.
Name | Type | Attributes | Description |
---|---|---|---|
items |
* |
<repeatable> |
the items to whitelist |
- Source: