Class ExtensionMethods
Extension methods. Mostly methods for configuring command argument
definitions using fluent config methods.
Inheritance
ExtensionMethods
Assembly: Benday.CommandsFramework.dll
Syntax
public static class ExtensionMethods
Methods
|
Edit this page
View Source
AddArgumentValue(CommandExecutionInfo, string, string)
Adds an argument value to the arguments in an
execution info object
Declaration
public static void AddArgumentValue(this CommandExecutionInfo execInfo, string argName, string argValue)
Parameters
Exceptions
|
Edit this page
View Source
AddBoolean(ArgumentCollection, string)
Adds a boolean argument definition
Declaration
public static BooleanArgument AddBoolean(this ArgumentCollection collection, string argumentName)
Parameters
| Type |
Name |
Description |
| ArgumentCollection |
collection |
Argument collection
|
| string |
argumentName |
Argument name on the command line
|
Returns
|
Edit this page
View Source
AddDateTime(ArgumentCollection, string)
Adds a datetime argument definition
Declaration
public static DateTimeArgument AddDateTime(this ArgumentCollection collection, string argumentName)
Parameters
| Type |
Name |
Description |
| ArgumentCollection |
collection |
Argument collection
|
| string |
argumentName |
Argument name on the command line
|
Returns
|
Edit this page
View Source
AddDirectory(ArgumentCollection, string)
Adds a directory argument definition
Declaration
public static DirectoryArgument AddDirectory(this ArgumentCollection collection, string argumentName)
Parameters
| Type |
Name |
Description |
| ArgumentCollection |
collection |
Argument collection
|
| string |
argumentName |
Argument name on the command line
|
Returns
|
Edit this page
View Source
AddFile(ArgumentCollection, string)
Adds a file argument definition
Declaration
public static FileArgument AddFile(this ArgumentCollection collection, string argumentName)
Parameters
| Type |
Name |
Description |
| ArgumentCollection |
collection |
Argument collection
|
| string |
argumentName |
Argument name on the command line
|
Returns
|
Edit this page
View Source
AddInt32(ArgumentCollection, string)
Adds a int32 argument definition
Declaration
public static Int32Argument AddInt32(this ArgumentCollection collection, string argumentName)
Parameters
| Type |
Name |
Description |
| ArgumentCollection |
collection |
Argument collection
|
| string |
argumentName |
Argument name on the command line
|
Returns
|
Edit this page
View Source
AddString(ArgumentCollection, string)
Adds a string argument definition
Declaration
public static StringArgument AddString(this ArgumentCollection collection, string argumentName)
Parameters
| Type |
Name |
Description |
| ArgumentCollection |
collection |
Argument collection
|
| string |
argumentName |
Argument name on the command line
|
Returns
|
Edit this page
View Source
AllowEmptyValue<T>(Argument<T>, bool)
Configures an argument definition to allow empty values
Declaration
public static Argument<T> AllowEmptyValue<T>(this Argument<T> arg, bool allowEmptyValue = true)
Parameters
| Type |
Name |
Description |
| Argument<T> |
arg |
Argument definition to configure
|
| bool |
allowEmptyValue |
Allow or disallow empty values
|
Returns
| Type |
Description |
| Argument<T> |
The argument
|
Type Parameters
Exceptions
|
Edit this page
View Source
AsNotRequired<T>(Argument<T>)
Configures an argument definition as not required
Declaration
public static Argument<T> AsNotRequired<T>(this Argument<T> arg)
Parameters
| Type |
Name |
Description |
| Argument<T> |
arg |
Argument definition to configure
|
Returns
| Type |
Description |
| Argument<T> |
The argument
|
Type Parameters
Exceptions
|
Edit this page
View Source
AsRequired<T>(Argument<T>)
Configures an argument definition as required
Declaration
public static Argument<T> AsRequired<T>(this Argument<T> arg)
Parameters
| Type |
Name |
Description |
| Argument<T> |
arg |
Argument definition to configure
|
Returns
| Type |
Description |
| Argument<T> |
The argument
|
Type Parameters
Exceptions
|
Edit this page
View Source
ExistenceOptional<T>(Argument<T>)
Configures an argument definition to not require existence.
Must be a file or directory argument.
Declaration
public static Argument<T> ExistenceOptional<T>(this Argument<T> arg)
Parameters
Returns
Type Parameters
Exceptions
|
Edit this page
View Source
FromPositionalArgument<T>(Argument<T>, int)
Gets the value from an unnamed variable based on position in the arg string.
Declaration
public static Argument<T> FromPositionalArgument<T>(this Argument<T> arg, int position)
Parameters
| Type |
Name |
Description |
| Argument<T> |
arg |
|
| int |
position |
Position in the arg string
|
Returns
Type Parameters
|
Edit this page
View Source
GetBooleanValue(ArgumentCollection, string)
Get an argument value as boolean
Declaration
public static bool GetBooleanValue(this ArgumentCollection args, string argumentName)
Parameters
Returns
| Type |
Description |
| bool |
The value as boolean
|
Exceptions
|
Edit this page
View Source
GetCloneOfArguments(CommandExecutionInfo, string, bool)
Declaration
public static CommandExecutionInfo GetCloneOfArguments(this CommandExecutionInfo execInfo, string commandName, bool quietMode)
Parameters
Returns
|
Edit this page
View Source
GetDateTimeValue(ArgumentCollection, string)
Get an argument value as DateTime
Declaration
public static DateTime GetDateTimeValue(this ArgumentCollection args, string argumentName)
Parameters
Returns
| Type |
Description |
| DateTime |
The value as DateTime
|
Exceptions
|
Edit this page
View Source
GetInt32Value(ArgumentCollection, string)
Get an argument value as int32
Declaration
public static int GetInt32Value(this ArgumentCollection args, string argumentName)
Parameters
Returns
| Type |
Description |
| int |
The value as int
|
Exceptions
|
Edit this page
View Source
GetPathToDirectory(ArgumentCollection, string, bool, bool)
Declaration
public static string GetPathToDirectory(this ArgumentCollection arguments, string argumentName, bool mustExist = false, bool fullyQualifiedPath = false)
Parameters
Returns
|
Edit this page
View Source
GetPathToFile(ArgumentCollection, string, bool, bool)
Declaration
public static string GetPathToFile(this ArgumentCollection arguments, string argumentName, bool mustExist = false, bool fullyQualifiedPath = false)
Parameters
Returns
|
Edit this page
View Source
GetRequiredConfigurationValue(CommandExecutionInfo, string)
Declaration
public static string GetRequiredConfigurationValue(this CommandExecutionInfo executionInfo, string configValueName)
Parameters
Returns
|
Edit this page
View Source
GetStringValue(ArgumentCollection, string)
Get an argument value as string
Declaration
public static string GetStringValue(this ArgumentCollection args, string argumentName)
Parameters
Returns
| Type |
Description |
| string |
The value as string
|
Exceptions
|
Edit this page
View Source
HasValue(ArgumentCollection, string)
Does this argument collection have a value for an argument
Declaration
public static bool HasValue(this ArgumentCollection args, string argumentName)
Parameters
Returns
| Type |
Description |
| bool |
True if there's a value
|
|
Edit this page
View Source
MustExist<T>(Argument<T>)
Configures an argument definition to require existence.
Must be a file or directory argument.
Declaration
public static Argument<T> MustExist<T>(this Argument<T> arg)
Parameters
Returns
Type Parameters
Exceptions
|
Edit this page
View Source
RemoveArgumentValue(CommandExecutionInfo, string)
Remove an argument value from the command execution info
Declaration
public static void RemoveArgumentValue(this CommandExecutionInfo execInfo, string argName)
Parameters
| Type |
Name |
Description |
| CommandExecutionInfo |
execInfo |
The execution information for the command
|
| string |
argName |
Argument name to remove
|
Exceptions
|
Edit this page
View Source
WithAlias<T>(Argument<T>, string)
Adds a alias to an argument definition
Declaration
public static Argument<T> WithAlias<T>(this Argument<T> arg, string alias)
Parameters
| Type |
Name |
Description |
| Argument<T> |
arg |
|
| string |
alias |
Alternate name for the argument
|
Returns
Type Parameters
|
Edit this page
View Source
WithDefaultValue<T>(Argument<T>, T)
Adds a default value for the argument definition
Declaration
public static Argument<T> WithDefaultValue<T>(this Argument<T> arg, T defaultValue)
Parameters
| Type |
Name |
Description |
| Argument<T> |
arg |
Argument definition to configure
|
| T |
defaultValue |
Default value
|
Returns
| Type |
Description |
| Argument<T> |
The argument
|
Type Parameters
Exceptions
|
Edit this page
View Source
WithDescription<T>(Argument<T>, string)
Adds a description to an argument definition
Declaration
public static Argument<T> WithDescription<T>(this Argument<T> arg, string description)
Parameters
| Type |
Name |
Description |
| Argument<T> |
arg |
|
| string |
description |
Human readable description for the argument
|
Returns
Type Parameters
|
Edit this page
View Source
WithFriendlyName<T>(Argument<T>, string)
Adds a user friendly name to an argument definition
Declaration
public static Argument<T> WithFriendlyName<T>(this Argument<T> arg, string friendlyName)
Parameters
| Type |
Name |
Description |
| Argument<T> |
arg |
|
| string |
friendlyName |
Human readable name for the argument
|
Returns
Type Parameters