Constructor
new ArgvElement(element, params)
Properties:
Name | Type | Description |
---|---|---|
type |
string
|
|
key |
string
|
element name (long name). |
shortKey |
string
|
short name of one character for an element of the option type |
value |
string
|
the value for the option type element |
default |
string
|
for an item of the command type, the default key.For an option type element, the default is. |
required |
boolean
|
required element |
errorMessage |
string
|
parsing error message |
descriptions |
string
|
to describe commands with this element. Used in Helper |
order |
string
|
assigned when parsing. for commands and determines command order. Intended for informational purposes only. |
pattern |
string
|
assigned when parsing. Added when comparing command line with pattern. Indicates, in the result element, the pattern object that was matched. Intended for informational purposes only. |
- Source:
Parameters:
Name | Type | Description |
---|---|---|
element |
string
|
object
|
where string is the command line element for the parser. If an object, then this is a set of element parameters (template for ArgvElement) |
params |
object
|
Methods
(static) parseElement(str) → {Array.<object>}
Argv elements parse. Converts an argv element string to an [object ArgvElement]
- Source:
Parameters:
Name | Type | Description |
---|---|---|
str |
string
|
Argv element string. Example: |
Returns:
- Type:
-
Array.<object>
Since the argv element can contain a set of options (-abcd = value), an array is always returned
Example
ArgvElement.parseElement('--option=value');
//result
[
"[object ArgvElement]"
]
(static) parseElement(str) → {Array.<object>}
Argv elements parse. Converts an argv element string to an [object ArgvElement]
- Source:
Parameters:
Name | Type | Description |
---|---|---|
str |
string
|
Argv element string. Example: |
Returns:
- Type:
-
Array.<object>
Since the argv element can contain a set of options (-abcd = value), an array is always returned
Example
ArgvElement.parseElement('--option=value');
//result
[
"[object ArgvElement]"
]
setParams(…args)
Setting parameters for an element
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
Array.<object>
|
Array.<ArgvElement>
|
<repeatable> |
setParams(…args)
Setting parameters for an element
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
Array.<object>
|
Array.<ArgvElement>
|
<repeatable> |