-
Notifications
You must be signed in to change notification settings - Fork 0
StartOptionBuilder
Lunar Doggo edited this page Jul 24, 2021
·
1 revision
A StartOptionBuilder
is used to create instances of the StartOption class.
public class StartOptionBuilder : AbstractOptionBuilder<StartOption>
public StartOptionBuilder(string longName, string shortName)
Initializes the builder with the most basic properties of a StartOption
: its long and short name
Signature | Description |
---|---|
public StartOptionBuilder SetValueParser(IStartOptionValueParser) |
Sets the type of value parser to be used for values assigned to the StartOption (List of predefined value parsers) |
public StartOptionBuilder SetValueType(StartOptionValueType) |
Sets, whether the StartOption can have values or not. Possible values: Switch , Single , Multiple ; if not set otherwise, it will automatically default to Switch
|
public StartOptionBuilder SetDescription(string) |
Sets the description of the StartOption to be displayed on the help page |
public StartOptionBuilder SetRequired(bool) |
Sets whether the StartOption is required to be set. If the option is inside a StartOptionGroup , the required flag will only come into effect, if the StartOptionGroup is selected by the user |
public override StartOption Build() |
Creates a new instance of StartOption with the previously set parameters |
Most basic:
StartOption option = new StartOptionBuilder("option", "o").Build();
Single int value:
StartOption option = new StartOptionBuilder("option", "o").SetValueType(StartOptionValueType.Single)
.SetValueParser(new Int32OptionValueParser()).Build();
Custom description and required:
StartOption option = new StartOptionBuilder("option", "o").SetDescription("Custom description for required option")
.SetRequired().Build();
All set:
StartOption option = new StartOptionBuilder("option", "o").SetValueType(StartOptionValueType.Single)
.SetValueParser(new Int32OptionValueParser()).SetDescription("This option uses all builder methods!")
.SetRequired().Build();