RoadmapShopEvents
Skip to main content

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

PropertyModifiersTypeDescription
descriptionstringDocumentation for the parameter that will be shown when invoking the tool with "--help"
environmentVariablestring | 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.
kindCommandLineParameterKindIndicates the type of parameter.
longNamestringThe long name of the flag including double dashes, e.g. "--do-something"
requiredbooleanIf true, then an error occurs if the parameter was not included on the command-line.
shortNamestring | undefinedAn optional short name for the flag including the dash, e.g. "-d"
undocumentedSynonymsstring[] | undefinedSpecifies additional names for this parameter that are accepted but not displayed in the command line help.

Methods

MethodModifiersDescription
appendToArgList(argList)Append the parsed values to the provided string array.
reportInvalidData(data)Internal usage only. Used to report unexpected output from the argparse library.
validateDefaultValue(hasDefaultValue)