Class Argument<T>
Base class for arguments
Implements
Inherited Members
Namespace: Benday.CommandsFramework
Assembly: Benday.CommandsFramework.dll
Syntax
public abstract class Argument<T> : IArgument
Type Parameters
| Name | Description |
|---|---|
| T | The data type for the argument |
Constructors
| Edit this page View SourceArgument(string)
Declaration
public Argument(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Properties
| Edit this page View SourceAlias
The alternate name of the argument when used on the command line
Declaration
public string Alias { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
AllowEmptyValue
Is an empty value valid? This is more helpful for boolean arguments when the existence of the argument on the command line call indicates that something should be done.
Declaration
public bool AllowEmptyValue { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
DataType
Data type for this argument
Declaration
public abstract ArgumentDataType DataType { get; }
Property Value
| Type | Description |
|---|---|
| ArgumentDataType |
Description
Human readable description of this argument
Declaration
public string Description { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
FriendlyName
Human readable friendly name for this argument
Declaration
public string FriendlyName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
HasAlias
Returns true if a command name alias is set
Declaration
public bool HasAlias { get; }
Property Value
| Type | Description |
|---|---|
| bool |
HasValue
Does this argument have a value?
Declaration
public bool HasValue { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsPositionalSource
Should this value come from an unnamed argument on the command line? If yes, the Alias value will be the POSITION_x.
Declaration
public bool IsPositionalSource { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsRequired
Is this argument required to have a value in order to be valid?
Declaration
public bool IsRequired { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Name
The name of the argument when used on the command line
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Value
The value of this argument
Declaration
public T Value { get; set; }
Property Value
| Type | Description |
|---|---|
| T |
Methods
| Edit this page View SourceGetDefaultValue()
Get the default value for this argument for this data type
Declaration
protected abstract T GetDefaultValue()
Returns
| Type | Description |
|---|---|
| T |
OnInitialize()
Template method for adding logic at the end of the initialization process
Declaration
protected virtual void OnInitialize()
TrySetValue(string)
Try to set the value for this argument
Declaration
public abstract bool TrySetValue(string input)
Parameters
| Type | Name | Description |
|---|---|---|
| string | input | String representation of the argument value |
Returns
| Type | Description |
|---|---|
| bool | True if the value could be converted to the argument's data type and the value was set |
Validate()
Validate this argument according to the configuration.
Declaration
public virtual bool Validate()
Returns
| Type | Description |
|---|---|
| bool | True if the argument is valid |