Class CommandOption<T>
- Namespace
- McMaster.Extensions.CommandLineUtils
- Assembly
- McMaster.Extensions.CommandLineUtils.dll
Represents one or many command line option that is identified by flag proceeded by '-' or '--'.
Options are not positional. Compare to CommandArgument<T>. The raw value must be
parsable into type T
public class CommandOption<T> : CommandOption
Type Parameters
TThe type of the option value(s)
- Inheritance
-
objectCommandOption<T>
- Inherited Members
- Extension Methods
Constructors
CommandOption(IValueParser<T>, string, CommandOptionType)
Initializes a new instance of CommandOption<T>
public CommandOption(IValueParser<T> valueParser, string template, CommandOptionType optionType)
Parameters
valueParserIValueParser<T>The parser use to convert values into type of T.
templatestringThe option template.
optionTypeCommandOptionTypeThe option type
Properties
DefaultValue
The default value of the option.
public T? DefaultValue { get; set; }
Property Value
- T
ParsedValue
The parsed value.
public T ParsedValue { get; }
Property Value
- T
ParsedValues
All parsed values;
public IReadOnlyList<T> ParsedValues { get; }
Property Value
Methods
Reset()
Clear any parsed values from this argument.
public override void Reset()