RoadmapShopEvents
Skip to main content

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

CommandLineParameterProvider class

This is the common base class for CommandLineAction and CommandLineParser that provides functionality for defining command-line parameters.

Signature:
export declare abstract class CommandLineParameterProvider

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 CommandLineParameterProvider class.

Properties

PropertyModifiersTypeDescription
parametersReadonlyArray<CommandLineParameter >Returns a collection of the parameters that were defined for this object.
parametersProcessedbooleanInforms the caller if the argparse data has been processed into parameters.
remainderCommandLineRemainder | undefinedIf CommandLineParameterProvider.defineCommandLineRemainder() was called, this object captures any remaining command line arguments after the recognized portion.

Methods

MethodModifiersDescription
defineChoiceListParameter(definition)Defines a command-line parameter whose value must be a string from a fixed set of allowable choices (similar to an enum). The parameter can be specified multiple times to build a list.
defineChoiceParameter(definition)Defines a command-line parameter whose value must be a string from a fixed set of allowable choices (similar to an enum).
defineCommandLineRemainder(definition)Defines a rule that captures any remaining command line arguments after the recognized portion.
defineFlagParameter(definition)Defines a command-line switch whose boolean value is true if the switch is provided, and false otherwise.
defineIntegerListParameter(definition)Defines a command-line parameter whose argument is an integer. The parameter can be specified multiple times to build a list.
defineIntegerParameter(definition)Defines a command-line parameter whose argument is an integer.
defineStringListParameter(definition)Defines a command-line parameter whose argument is a single text string. The parameter can be specified multiple times to build a list.
defineStringParameter(definition)Defines a command-line parameter whose argument is a single text string.
getChoiceListParameter(parameterLongName)Returns the CommandLineChoiceListParameter with the specified long name.
getChoiceParameter(parameterLongName)Returns the CommandLineChoiceParameter with the specified long name.
getFlagParameter(parameterLongName)Returns the CommandLineFlagParameter with the specified long name.
getIntegerListParameter(parameterLongName)Returns the CommandLineIntegerParameter with the specified long name.
getIntegerParameter(parameterLongName)Returns the CommandLineIntegerParameter with the specified long name.
getParameterStringMap()Returns a object which maps the long name of each parameter in this.parameters to the stringified form of its value. This is useful for logging telemetry, but it is not the proper way of accessing parameters or their values.
getStringListParameter(parameterLongName)Returns the CommandLineStringListParameter with the specified long name.
getStringParameter(parameterLongName)Returns the CommandLineStringParameter with the specified long name.
onDefineParameters()The child class should implement this hook to define its command-line parameters, e.g. by calling defineFlagParameter().
renderHelpText()Generates the command-line help text.