ArgumentOrEnvironmentVariableAlias.

ArgumentOrEnvironmentVariable(ICakeContext, string, string, bool) Method

Summary

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

Syntax

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

Attributes

Type Description
CakeMethodAliasAttribute
CakeAliasCategoryAttribute
CakeAliasCategoryAttribute

Parameters

Name Type Description
context ICakeContext
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 bool

Return Value

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