Class ValueOption<T>

Namespace
Pixie.Options
Assembly
Pixie.dll

Describes a value option: an option takes exactly one argument.

public sealed class ValueOption<T> : Option

Type Parameters

T
Inheritance
ValueOption<T>
Inherited Members

Constructors

ValueOption(OptionForm, Func<OptionForm, string, ILog, T>, T)

Creates a value option from an option form, a function that parses an argument and a default value.

public ValueOption(OptionForm form, Func<OptionForm, string, ILog, T> parseArgument, T defaultValue)

Parameters

form OptionForm

The option's form.

parseArgument Func<OptionForm, string, ILog, T>

A function that parses a string argument.

defaultValue T

A default value for the value option.

ValueOption(IReadOnlyList<OptionForm>, Func<OptionForm, string, ILog, T>, T)

Creates a value option from a list of forms, a function that parses an argument and a default value.

public ValueOption(IReadOnlyList<OptionForm> forms, Func<OptionForm, string, ILog, T> parseArgument, T defaultValue)

Parameters

forms IReadOnlyList<OptionForm>

The list of forms that the value option accepts.

parseArgument Func<OptionForm, string, ILog, T>

A function that parses a string argument.

defaultValue T

A default value for the value option.

Properties

DefaultValue

Gets the option's default value.

public override object DefaultValue { get; }

Property Value

object

The default value.

Documentation

Gets the option's documentation.

public override OptionDocs Documentation { get; }

Property Value

OptionDocs

The documentation for the option.

Forms

Gets a list of all forms this option accepts.

public override IReadOnlyList<OptionForm> Forms { get; }

Property Value

IReadOnlyList<OptionForm>

The option's forms.

Methods

CreateParser(OptionForm)

Create a parser for one of this option's forms.

public override OptionParser CreateParser(OptionForm form)

Parameters

form OptionForm

The form to parse.

Returns

OptionParser

An option parser.

MergeValues(ParsedOption, ParsedOption)

Merges the values of two parsed options. Both have forms that belong to this option. These forms may or may not be the same.

public override ParsedOption MergeValues(ParsedOption first, ParsedOption second)

Parameters

first ParsedOption

The first parsed option.

second ParsedOption

The second parsed option.

Returns

ParsedOption

A composite parsed option.

WithCategory(string)

Creates a copy of this option that is classified under a particular category.

public ValueOption<T> WithCategory(string category)

Parameters

category string

The new option's category.

Returns

ValueOption<T>

An option.

WithDescription(Block)

Creates a copy of this option that has a particular description.

public ValueOption<T> WithDescription(Block description)

Parameters

description Block

The new option's description.

Returns

ValueOption<T>

An option.

WithParameter(OptionParameter)

Creates a copy of this option that has a particular parameter.

public ValueOption<T> WithParameter(OptionParameter parameter)

Parameters

parameter OptionParameter

The new option's sole parameter.

Returns

ValueOption<T>

An option.

WithParameter(string)

Creates a copy of this option that has a symbolic parameter.

public ValueOption<T> WithParameter(string name)

Parameters

name string

The parameter's display name.

Returns

ValueOption<T>

An option.