Interface IArgument
Interface describing the methods and properties for an argument
Namespace: Benday.CommandsFramework
Assembly: Benday.CommandsFramework.dll
Syntax
public interface IArgument
Properties
| Edit this page View SourceAlias
The alternate name of the argument when used on the command line
Declaration
string Alias { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
AllowEmptyValue
Allow or disallow empty values
Declaration
bool AllowEmptyValue { get; }
Property Value
| Type | Description |
|---|---|
| bool |
AllowedValues
List of valid values for this argument. Empty array means any value is accepted. When non-empty, the argument value must match one of these values (case-insensitive).
Declaration
string[] AllowedValues { get; }
Property Value
| Type | Description |
|---|---|
| string[] |
DataType
Data type for the argument
Declaration
[JsonConverter(typeof(JsonStringEnumConverter))]
ArgumentDataType DataType { get; }
Property Value
| Type | Description |
|---|---|
| ArgumentDataType |
DefaultValue
The explicit default value for this argument as configured by WithDefaultValue(). This is the string form of the configured default and is never changed by values supplied on the command line or from configuration. Empty string when no explicit default has been configured.
Declaration
string DefaultValue { get; }
Property Value
| Type | Description |
|---|---|
| string |
Description
Human readable description for the argument
Declaration
string Description { get; }
Property Value
| Type | Description |
|---|---|
| string |
FriendlyName
Human readable name label for the argument
Declaration
string FriendlyName { get; }
Property Value
| Type | Description |
|---|---|
| string |
HasAlias
Returns true if a command name alias is set
Declaration
bool HasAlias { get; }
Property Value
| Type | Description |
|---|---|
| bool |
HasDefaultValue
Returns true when an explicit default value has been configured via WithDefaultValue(). This is false for the implicit type default (empty string, false, 0, DateTime.MinValue) that every argument starts with.
Declaration
bool HasDefaultValue { get; }
Property Value
| Type | Description |
|---|---|
| bool |
HasValue
Does this argument have a value?
Declaration
bool HasValue { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsFromConfig
Should this value come from configuration instead of command line? The value can still be overridden via command line.
Declaration
bool IsFromConfig { get; set; }
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
bool IsPositionalSource { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsRequired
Is this argument required to have a value?
Declaration
bool IsRequired { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Name
Name of the argument on the command line
Declaration
string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Value
Value for the argument
Declaration
string Value { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
| Edit this page View SourceTrySetValue(string)
Try to set a value to this argument.
Declaration
bool TrySetValue(string input)
Parameters
| Type | Name | Description |
|---|---|---|
| string | input | Value to set |
Returns
| Type | Description |
|---|---|
| bool | True if the value could be converted to the appropriate data type and was successfully set as the argument value. |
Validate()
Validate the argument value against the argument definition information
Declaration
bool Validate()
Returns
| Type | Description |
|---|---|
| bool | True if the value is valid |