Arguments And Environment Variables

This page explains how settings can be passed to Cake file.

Passing And Reading Arguments

Call the Argument alias in your Cake file to read arguments from the command line:

Argument<bool>("myargument", false);

The argument can be passed while running Cake:

--myargument=true

The conversion uses type converters under the hood to convert the string value to the desired type.

Reading Environment Variables

Call the Environment variables alias alias in your Cake file to get the environment variable.

The following example will read the value of the BUILD_NUMBER environment variable or return 42 if the environment variable is not defined:

Information(EnvironmentVariable<int>("BUILD_NUMBER", 42));