Home > @rushstack/ts-command-line > CommandLineParameterProvider > defineChoiceListParameter
CommandLineParameterProvider.defineChoiceListParameter() method
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.
Signature:
defineChoiceListParameter<TChoice extends string = string>(definition: ICommandLineChoiceListDefinition<TChoice>): CommandLineChoiceListParameter<TChoice>;
Parameters
Parameter | Type | Description |
|---|---|---|
definition | ICommandLineChoiceListDefinition<TChoice> |
Returns:
CommandLineChoiceListParameter<TChoice>
Remarks
Example of a choice list parameter:
example-tool --allow-color red --allow-color green