Skip to main content

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

ICommandLineChoiceDefinition interface

For use with CommandLineParameterProvider.defineChoiceParameter(), this interface defines a command line parameter which is constrained to a list of possible options.


export interface ICommandLineChoiceDefinition extends IBaseCommandLineDefinition 

Extends: IBaseCommandLineDefinition


alternativesstring[]A list of strings (which contain no spaces), of possible options which can be selected
completions?() => Promise<string[]>(Optional) An optional callback that provides a list of custom choices for tab completion.
defaultValue?string(Optional) The default value which will be used if the parameter is omitted from the command line.

Documentation for the parameter that will be shown when invoking the tool with "--help"

(Inherited from IBaseCommandLineDefinition)


(Optional) The name of an environment variable that the parameter value will be read from, if it was omitted from the command-line. An error will be reported if the environment value cannot be parsed.

(Inherited from IBaseCommandLineDefinition)

parameterGroup?string | typeof SCOPING_PARAMETER_GROUP

(Optional) An optional parameter group name, shown when invoking the tool with "--help"

(Inherited from IBaseCommandLineDefinition)


The long name of the flag including double dashes, e.g. "--do-something"

(Inherited from IBaseCommandLineDefinition)


(Optional) An optional parameter scope name, used to add a scope-prefixed parameter synonym, e.g. "--scope:do-something". Scopes provide additional flexibility for parameters in conflict resolution since when a scope is specified, parameters that have conflicting long names will be defined using only the scope-prefixed name.

(Inherited from IBaseCommandLineDefinition)


(Optional) An optional short name for the flag including the dash, e.g. "-d"

(Inherited from IBaseCommandLineDefinition)


(Optional) If true, then an error occurs if the parameter was not included on the command-line.

(Inherited from IBaseCommandLineDefinition)


(Optional) Specifies additional names for this parameter that are accepted but not displayed in the command line help.

(Inherited from IBaseCommandLineDefinition)