ArgumentAliases.

HasArgument(ICakeContext, string) Method

Summary

Determines whether or not the specified argument exist.
Namespace
Cake.Common
Containing Type
ArgumentAliases

Syntax

[CakeMethodAlias]
public static bool HasArgument(this ICakeContext context, string name)

Examples

This sample shows how to call the HasArgument(ICakeContext, string) method.
var argumentName = "myArgument";
// Cake.exe .\hasargument.cake -myArgument="is specified"
if (HasArgument(argumentName))
{
    Information("{0} is specified", argumentName);
}
// Cake.exe .\hasargument.cake
else
{
    Warning("{0} not specified", argumentName);
}

Attributes

Type Description
CakeMethodAliasAttribute An attribute used to mark script method aliases.

Parameters

Name Type Description
context ICakeContext The context.
name string The argument name.

Return Value

Type Description
bool Whether or not the specified argument exist.