Class SequenceOption<T>
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
formOptionFormThe option's form.
parseArgumentFunc<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
formsIReadOnlyList<OptionForm>The list of forms that the sequence option accepts.
parseArgumentFunc<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
formOptionFormThe 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
firstParsedOptionThe first parsed option.
secondParsedOptionThe 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
categorystringThe 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
descriptionBlockThe 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
namestringThe 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
namestringThe parameter's display name.
isVarargsboolTells 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
parametersOptionParameter[]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
parametersIReadOnlyList<OptionParameter>The new option's parameter list.
Returns
- SequenceOption<T>
An option.