Class CommandLineArgAttribute
- Namespace
- Ubiquity.CommandLineParsing
- Assembly
- Ubiquity.CommandlineParsing.dll
Allows accessing a property via the command line parser with a name that is different from the property name.
[AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
public sealed class CommandLineArgAttribute : Attribute
- Inheritance
-
CommandLineArgAttribute
- Inherited Members
- Extension Methods
Constructors
CommandLineArgAttribute()
Initializes a new instance of the CommandLineArgAttribute class.
public CommandLineArgAttribute()
Remarks
Marks the attached property for command line argument binding. The name of the property is the option for the command line. If the LongName property is set it is used as the option name. Blay
CommandLineArgAttribute(string)
Initializes a new instance of the CommandLineArgAttribute class.
public CommandLineArgAttribute(string shortName)
Parameters
shortName
stringShort name for the argument.
Properties
AllowSpaceDelimitedValue
Gets or sets a value indicating whether the option allows a space delimited value.
public bool AllowSpaceDelimitedValue { get; set; }
Property Value
Remarks
Normally an option followed by a space is treated as a boolean flag and a distinct positional argument. Setting this to true will allow treating the positional argument as the value for the item.
note
Setting this makes the value required such that an exception is generated if the option is followed by another option or the end of the command line.
LongName
Gets the long form name for the command line argument.
public string LongName { get; init; }
Property Value
ShortName
Gets short form name for the command line argument.
public string ShortName { get; }