Summary
Determines whether or not the specified argument exist.
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
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. |