Summary
Gets an argument and throws if the argument is missing.
Syntax
[CakeMethodAlias]
public static T Argument<T>(this ICakeContext context, string name)
Examples
// Cake.exe .\argument.cake --myArgument="is valid" --loopCount=5
Information("Argument {0}", Argument<string>("myArgument"));
var loopCount = Argument<int>("loopCount");
for(var index = 0;index<loopCount; index++)
{
Information("Index {0}", index);
}
Attributes
Type Parameters
Name |
Description |
T |
The argument type. |
Parameters
Name |
Type |
Description |
context |
ICakeContext |
The context. |
name |
string |
The argument name. |
Return Value
Type |
Description |
T |
The value of the argument. |