Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/ts-command-line > CommandLineParameter

CommandLineParameter class

The base class for the various command-line parameter types.


export declare abstract class CommandLineParameter 


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.


descriptionreadonlystringDocumentation for the parameter that will be shown when invoking the tool with "--help"
environmentVariablereadonlystring | undefinedThe 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.



CommandLineParameterKindIndicates the type of parameter.
longNamereadonlystringThe long name of the flag including double dashes, e.g. "--do-something"
parameterGroupreadonlystring | typeof SCOPING_PARAMETER_GROUP | undefinedAn optional parameter group name, shown when invoking the tool with "--help"
parameterScopereadonlystring | undefinedAn 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.
requiredreadonlybooleanIf true, then an error occurs if the parameter was not included on the command-line.
scopedLongNamereadonlystring | undefinedIf a parameterScope is provided, returns the scope-prefixed long name of the flag, including double dashes, eg. "--scope:do-something". Otherwise undefined.
shortNamereadonlystring | undefinedAn optional short name for the flag including the dash, e.g. "-d"
undocumentedSynonymsreadonlystring[] | undefinedSpecifies additional names for this parameter that are accepted but not displayed in the command line help.


appendToArgList(argList)abstractAppend the parsed values to the provided string array.
reportInvalidData(data)protectedInternal usage only. Used to report unexpected output from the argparse library.