ArgumentAliases.

Argument<T>(ICakeContext, string) Method

Summary

Gets an argument and throws if the argument is missing.
Namespace
Cake.Common
Containing Type
ArgumentAliases

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 Description
CakeMethodAliasAttribute An attribute used to mark script method aliases.

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.