Class FlagOption

Namespace
Pixie.Options
Assembly
Pixie.dll

Describes a flag option: a Boolean option whose value is set by mentioning one of the option's forms. Flag options take no arguments.

public sealed class FlagOption : Option
Inheritance
FlagOption
Inherited Members

Constructors

FlagOption(OptionForm)

Creates a flag option from a positive form. The flag's default value is false.

public FlagOption(OptionForm positiveForm)

Parameters

positiveForm OptionForm

A positive form for the flag option.

FlagOption(OptionForm, OptionForm, bool)

Creates a flag option from a positive form, a negative form and a default value.

public FlagOption(OptionForm positiveForm, OptionForm negativeForm, bool defaultValue)

Parameters

positiveForm OptionForm

A positive form for the flag option.

negativeForm OptionForm

A negative form for the flag option.

defaultValue bool

A default value for the flag option.

FlagOption(IReadOnlyList<OptionForm>, IReadOnlyList<OptionForm>, bool)

Creates a flag option from a list of positive forms, a list of negative forms and a default value.

public FlagOption(IReadOnlyList<OptionForm> positiveForms, IReadOnlyList<OptionForm> negativeForms, bool defaultValue)

Parameters

positiveForms IReadOnlyList<OptionForm>

A list of positive forms for the flag option.

negativeForms IReadOnlyList<OptionForm>

A list of negative forms for the flag option.

defaultValue bool

A default value for the flag 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.

NegativeForms

Gets a list of negative forms for this flag option.

public IReadOnlyList<OptionForm> NegativeForms { get; }

Property Value

IReadOnlyList<OptionForm>

A list of negative forms for this flag option.

PositiveForms

Gets a list of positive forms for this flag option.

public IReadOnlyList<OptionForm> PositiveForms { get; }

Property Value

IReadOnlyList<OptionForm>

A list of positive forms for this flag option.

Methods

CreateFlagOption(params OptionForm[])

Creates a simple flag option that is turned off by default and is turned on when one or more of its forms is encountered.

public static FlagOption CreateFlagOption(params OptionForm[] forms)

Parameters

forms OptionForm[]

The option forms to accept.

Returns

FlagOption

A flag option.

CreateFlagOption(IReadOnlyList<OptionForm>)

Creates a simple flag option that is turned off by default and is turned on when one or more of its forms is encountered.

public static FlagOption CreateFlagOption(IReadOnlyList<OptionForm> forms)

Parameters

forms IReadOnlyList<OptionForm>

The option forms to accept.

Returns

FlagOption

A flag option.

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

Parameters

category string

The new option's category.

Returns

FlagOption

An option.

WithDescription(Block)

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

public FlagOption WithDescription(Block description)

Parameters

description Block

The new option's description.

Returns

FlagOption

An option.