Home > @rushstack/ts-command-line > CommandLineParameterProvider > defineChoiceParameter
CommandLineParameterProvider.defineChoiceParameter() method
Defines a command-line parameter whose value must be a string from a fixed set of allowable choices (similar to an enum).
Signature:
defineChoiceParameter<TChoice extends string = string>(definition: ICommandLineChoiceDefinition<TChoice> & {
defaultValue: TChoice;
}): IRequiredCommandLineChoiceParameter<TChoice>;
Parameters
Parameter | Type | Description |
|---|---|---|
definition | ICommandLineChoiceDefinition<TChoice> & { defaultValue: TChoice; } |
Returns:
IRequiredCommandLineChoiceParameter<TChoice>
Remarks
Example of a choice parameter:
example-tool --log-level warn