Home > @rushstack/ts-command-line > CommandLineParameter
CommandLineParameter class
The base class for the various command-line parameter types.
Signature:
export declare abstract class CommandLineParameter
Remarks
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the CommandLineParameter
class.
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
description | readonly | string | Documentation for the parameter that will be shown when invoking the tool with "--help" |
environmentVariable | readonly | string | undefined | The name of an environment variable that the parameter value will be read from, if it was omitted from the command-line. An error will be reported if the environment value cannot be parsed. |
kind |
| CommandLineParameterKind | Indicates the type of parameter. |
longName | readonly | string | The long name of the flag including double dashes, e.g. "--do-something" |
parameterGroup | readonly | string | typeof SCOPING_PARAMETER_GROUP | undefined | An optional parameter group name, shown when invoking the tool with "--help" |
parameterScope | readonly | string | undefined | An optional parameter scope name, used to add a scope-prefixed parameter synonym, e.g. "--scope:do-something". Scopes provide additional flexibility for parameters in conflict resolution since when a scope is specified, parameters that have conflicting long names will be defined using only the scope-prefixed name. |
required | readonly | boolean | If true, then an error occurs if the parameter was not included on the command-line. |
scopedLongName | readonly | string | undefined | If a parameterScope is provided, returns the scope-prefixed long name of the flag, including double dashes, eg. "--scope:do-something". Otherwise undefined. |
shortName | readonly | string | undefined | An optional short name for the flag including the dash, e.g. "-d" |
undocumentedSynonyms | readonly | string[] | undefined | Specifies additional names for this parameter that are accepted but not displayed in the command line help. |
Methods
Method | Modifiers | Description |
---|---|---|
appendToArgList(argList) | abstract | Append the parsed values to the provided string array. |
reportInvalidData(data) | protected | Internal usage only. Used to report unexpected output from the argparse library. |
validateDefaultValue(hasDefaultValue) | protected |