Home > @microsoft/ts-command-line > CommandLineParameter > environmentVariable

CommandLineParameter.environmentVariable property

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.


readonly environmentVariable: string | undefined;


The environment variable name must consist only of upper-case letters, numbers, and underscores. It may not start with a number.

This feature cannot be used when IBaseCommandLineDefinition.required is true, because in that case the environmentVariable would never be used.