Class SequenceOption<T>

Namespace
Pixie.Options
Assembly
Pixie.dll

Describes a sequence option: an option that can take any number of arguments. Each argument is parsed identically and the result of the option is formatted as an IReadOnlyList<T>.

public sealed class SequenceOption<T> : Option

Type Parameters

T
Inheritance
SequenceOption<T>
Inherited Members

Constructors

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

Creates a sequence option from an option form and a function that parses a single argument.

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

Parameters

form OptionForm

The option's form.

parseArgument Func<OptionForm, string, ILog, T>

A function that parses a single string argument.

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

Creates a sequence option from a list of forms and a function that parses a single argument.

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

Parameters

forms IReadOnlyList<OptionForm>

The list of forms that the sequence option accepts.

parseArgument Func<OptionForm, string, ILog, T>

A function that parses a single string argument.

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 SequenceOption<T> WithCategory(string category)

Parameters

category string

The new option's category.

Returns

SequenceOption<T>

An option.

WithDescription(Block)

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

public SequenceOption<T> WithDescription(Block description)

Parameters

description Block

The new option's description.

Returns

SequenceOption<T>

An option.

WithParameter(string)

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

public SequenceOption<T> WithParameter(string name)

Parameters

name string

The parameter's display name.

Returns

SequenceOption<T>

An option.

WithParameter(string, bool)

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

public SequenceOption<T> WithParameter(string name, bool isVarargs)

Parameters

name string

The parameter's display name.

isVarargs bool

Tells if the parameter can take more than one argument.

Returns

SequenceOption<T>

An option.

WithParameters(params OptionParameter[])

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

public SequenceOption<T> WithParameters(params OptionParameter[] parameters)

Parameters

parameters OptionParameter[]

The new option's parameter list.

Returns

SequenceOption<T>

An option.

WithParameters(IReadOnlyList<OptionParameter>)

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

public SequenceOption<T> WithParameters(IReadOnlyList<OptionParameter> parameters)

Parameters

parameters IReadOnlyList<OptionParameter>

The new option's parameter list.

Returns

SequenceOption<T>

An option.