Table of Contents

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

T

The type of the option value(s)

Inheritance
object
CommandOption<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

valueParser IValueParser<T>

The parser use to convert values into type of T.

template string

The option template.

optionType CommandOptionType

The 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

IReadOnlyList<T>

Methods

Reset()

Clear any parsed values from this argument.

public override void Reset()