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

Property Modifiers Type Description
parameters   ReadonlyArray<CommandLineParameter> Returns a collection of the parameters that were defined for this object.
remainder   CommandLineRemainder | undefined If CommandLineParameterProvider.defineCommandLineRemainder() was called, this object captures any remaining command line arguments after the recognized portion.

Methods

Method Modifiers Description
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.
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.
getChoiceParameter(parameterLongName)   Returns the CommandLineChoiceParameter with the specified long name.
getFlagParameter(parameterLongName)   Returns the CommandLineFlagParameter with the specified long name.
getIntegerParameter(parameterLongName)   Returns the CommandLineIntegerParameter with the specified long name.
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.