Home > @microsoft/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.

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).
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 value is an integer.
defineStringListParameter(definition)   Defines a command-line parameter whose value is one or more text strings.
defineStringParameter(definition)   Defines a command-line parameter whose value 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.