Rush StackShopBlogEvents
Skip to main content

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>): CommandLineChoiceParameter<TChoice>;

Parameters

Parameter

Type

Description

definition

ICommandLineChoiceDefinition<TChoice>

Returns:

CommandLineChoiceParameter<TChoice>

Remarks

Example of a choice parameter:

example-tool --log-level warn