ArgumentOrEnvironmentVariableAlias.

ArgumentOrEnvironmentVariable(ICakeContext, string, string, string) Method

Summary

Get a string variable from various script inputs: first via Argument, then falling back on EnvironmentVariable, finally falling back on a default.

Syntax

public static string ArgumentOrEnvironmentVariable(this ICakeContext context, string name, string environmentNamePrefix, string defaultValue)

Attributes

Type Description
CakeMethodAliasAttribute
CakeAliasCategoryAttribute

Parameters

Name Type Description
context ICakeContext Cake context
name string The argument name to attempt to find in the command line parameters, prefixing with environmentNamePrefix to attempt to find in environment variables.
environmentNamePrefix string An optional prefix used to qualify the same variable name when present in EnvironmentVariable form (e.g., "MySetting" command-line argument vs. "MyTool_MySetting" environment variable).
defaultValue string The default value

Return Value

Type Description
string Value found or default, first checked in command-line argument, then environment variable.