RoadmapShopEvents
Skip to main content

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

DynamicCommandLineParser class

Signature:

export declare class DynamicCommandLineParser extends CommandLineParser 

Extends: CommandLineParser

Constructors

ConstructorModifiersDescription
(constructor)(options)

Constructs a new instance of the CommandLineParser class

(Inherited from CommandLineParser)

Properties

PropertyModifiersTypeDescription
actionsreadonlyReadonlyArray<CommandLineAction>

Returns the list of actions that were defined for this CommandLineParser object.

(Inherited from CommandLineParser)

parametersreadonlyReadonlyArray<CommandLineParameter>

Returns a collection of the parameters that were defined for this object.

(Inherited from CommandLineParameterProvider)

parametersProcessedreadonlyboolean

Informs the caller if the argparse data has been processed into parameters.

(Inherited from CommandLineParameterProvider)

remainderreadonlyCommandLineRemainder | undefined

If CommandLineParameterProvider.defineCommandLineRemainder() was called, this object captures any remaining command line arguments after the recognized portion.

(Inherited from CommandLineParameterProvider)

selectedActionCommandLineAction | undefined

Reports which CommandLineAction was specified on the command line.

(Inherited from CommandLineParser)

Methods

MethodModifiersDescription
addAction(action)

Defines a new action that can be used with the CommandLineParser instance.

(Inherited from CommandLineParser)

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.

(Inherited from CommandLineParameterProvider)

defineChoiceParameter(definition)

Defines a command-line parameter whose value must be a string from a fixed set of allowable choices (similar to an enum).

(Inherited from CommandLineParameterProvider)

defineCommandLineRemainder(definition)

Defines a rule that captures any remaining command line arguments after the recognized portion.

(Inherited from CommandLineParameterProvider)

defineFlagParameter(definition)

Defines a command-line switch whose boolean value is true if the switch is provided, and false otherwise.

(Inherited from CommandLineParameterProvider)

defineIntegerListParameter(definition)

Defines a command-line parameter whose argument is an integer. The parameter can be specified multiple times to build a list.

(Inherited from CommandLineParameterProvider)

defineIntegerParameter(definition)

Defines a command-line parameter whose argument is an integer.

(Inherited from CommandLineParameterProvider)

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.

(Inherited from CommandLineParameterProvider)

defineStringParameter(definition)

Defines a command-line parameter whose argument is a single text string.

(Inherited from CommandLineParameterProvider)

execute(args)

The program entry point will call this method to begin parsing command-line arguments and executing the corresponding action.

(Inherited from CommandLineParser)

executeWithoutErrorHandling(args)

This is similar to CommandLineParser.execute(), except that execution errors simply cause the promise to reject. It is the caller's responsibility to trap

(Inherited from CommandLineParser)

getAction(actionName)

Retrieves the action with the specified name. If no matching action is found, an exception is thrown.

(Inherited from CommandLineParser)

getChoiceListParameter(parameterLongName, parameterScope)

Returns the CommandLineChoiceListParameter with the specified long name.

(Inherited from CommandLineParameterProvider)

getChoiceParameter(parameterLongName, parameterScope)

Returns the CommandLineChoiceParameter with the specified long name.

(Inherited from CommandLineParameterProvider)

getFlagParameter(parameterLongName, parameterScope)

Returns the CommandLineFlagParameter with the specified long name.

(Inherited from CommandLineParameterProvider)

getIntegerListParameter(parameterLongName, parameterScope)

Returns the CommandLineIntegerParameter with the specified long name.

(Inherited from CommandLineParameterProvider)

getIntegerParameter(parameterLongName, parameterScope)

Returns the CommandLineIntegerParameter with the specified long name.

(Inherited from CommandLineParameterProvider)

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.

(Inherited from CommandLineParameterProvider)

getStringListParameter(parameterLongName, parameterScope)

Returns the CommandLineStringListParameter with the specified long name.

(Inherited from CommandLineParameterProvider)

getStringParameter(parameterLongName, parameterScope)

Returns the CommandLineStringParameter with the specified long name.

(Inherited from CommandLineParameterProvider)

onDefineParameters()protected
onExecute()protected

This hook allows the subclass to perform additional operations before or after the chosen action is executed.

(Inherited from CommandLineParser)

parseScopedLongName(scopedLongName)

Returns an object with the parsed scope (if present) and the long name of the parameter.

(Inherited from CommandLineParameterProvider)

renderHelpText()

Generates the command-line help text.

(Inherited from CommandLineParameterProvider)

renderUsageText()

Generates the command-line usage text.

(Inherited from CommandLineParameterProvider)

tryGetAction(actionName)

Retrieves the action with the specified name. If no matching action is found, undefined is returned.

(Inherited from CommandLineParser)