DotNet-Arguments 2.0.0
A simple and 'to-the-point' library to parse launch arguments in .NET and .NET Core applications.
Loading...
Searching...
No Matches
Option Class Reference

Class Option models an option linked to one or more Verb that can be given in launch arguments to pass a value or toggle some behavior/actions. More...

Public Member Functions

 Option (char? token, string? name, string? description="", OptionFlags flags=OptionFlags.None)
 Common constructor for any Option. More...
 
void Clear ()
 Clears any field that may be modified once the launch arguments are parsed. More...
 
bool HasToken ()
 Checks if the Option has a token character. More...
 
bool HasName ()
 Checks if the Option has a name string. More...
 
string GetFullName (bool addTicks=false)
 Retrieve a proper and safe to print name representation for the Option. More...
 
bool HasValue ()
 Checks if the Option was used and received a value during the parsing process. More...
 
bool WasUsed ()
 Checks if the Option was used in the parsed launch arguments. More...
 

Public Attributes

readonly List< string > Arguments
 List of values given to the Option if it is allowed to have any.
If it isn't allowed to hold any, the list will just be instantiated and empty. More...
 
readonly? string Description
 Description as shown in the help text.
Will be treated as non-present, or on empty string if left as null. More...
 
OptionFlags Flags
 Binary flags used to toggle some special behavior and conditions during the parsing process. More...
 
readonly? string Name
 Name string used when searching for the Option or rendering the help text.
May be left as null to indicate that it has no long name. More...
 
readonly? char Token
 Token character used when searching for the Option or rendering the help text.
May be left as null to indicate that it has no token. More...
 
int Occurrences
 Counter used to indicate how many times the Option was used during the parsing process. More...
 

Properties

bool IsDefault [get, set]
 Interacts with the OptionFlags.Default flag that may have been given in the constructor, or modified through this property. More...
 
bool CanHaveValue [get, set]
 Interacts with the OptionFlags.HasValue flag that may have been given in the constructor, or modified through this property. More...
 
bool IsRepeatable [get, set]
 Interacts with the OptionFlags.Repeatable flag that may have been given in the constructor, or modified through this property. More...
 
bool IsHidden [get, set]
 Interacts with the OptionFlags.Hidden flag that may have been given in the constructor, or modified through this property. More...
 
bool IsRequired [get, set]
 Interacts with the OptionFlags.Required flag that may have been given in the constructor, or modified through this property. More...
 
bool ShouldStopParsing [get, set]
 Interacts with the OptionFlags.StopsParsing flag that may have been given in the constructor, or modified through this property. More...
 
bool AllowsVerbsAfter [get, set]
 Interacts with the OptionFlags.AllowVerbsAfter flag that may have been given in the constructor, or modified through this property. More...
 
bool ShouldSkipParsingRequirementChecks [get, set]
 Interacts with the OptionFlags.SkipsRequiredChecks flag that may have been given in the constructor, or modified through this property. More...
 
bool CanHaveMultipleValue [get, set]
 Interacts with the OptionFlags.HasValue and OptionFlags.Repeatable flags that may have been given in the constructor, or modified through this property. More...
 

Detailed Description

Class Option models an option linked to one or more Verb that can be given in launch arguments to pass a value or toggle some behavior/actions.

Constructor & Destructor Documentation

◆ Option()

Option.Option ( char?  token,
string?  name,
string?  description = "",
OptionFlags  flags = OptionFlags.None 
)
inline

Common constructor for any Option.

Parameters
tokenNullable token character used when searching for it in a Verb.
nameNullable name string used when searching for it in a Verb.
descriptionDescription as shown in the help text.
flagsBinary flags used to toggle some special behavior and conditions during the parsing process.
Exceptions
Exceptions.MissingOptionIdentifierExceptionThrown is a null token and name were given.
Exceptions.InvalidFlagsExceptionThrown if some invalid OptionFlags combination was given in flags.
See also
NibblePoker.Library.Arguments.OptionFlags

Member Function Documentation

◆ Clear()

void Option.Clear ( )
inline

Clears any field that may be modified once the launch arguments are parsed.

See also
NibblePoker.Library.Arguments.Option.Clear

◆ GetFullName()

string Option.GetFullName ( bool  addTicks = false)
inline

Retrieve a proper and safe to print name representation for the Option.

Parameters
addTicksAdds the - and prefixes to the output as needed.
Returns
The name in the t, token or t|token format.
See also
NibblePoker.Library.Arguments.HelpText

◆ HasName()

bool Option.HasName ( )
inline

Checks if the Option has a name string.

Returns
true if it has a name string, false otherwise.

◆ HasToken()

bool Option.HasToken ( )
inline

Checks if the Option has a token character.

Returns
true if it has a token character, false otherwise.

◆ HasValue()

bool Option.HasValue ( )
inline

Checks if the Option was used and received a value during the parsing process.

Returns
true if it has one or more value, false otherwise.

◆ WasUsed()

bool Option.WasUsed ( )
inline

Checks if the Option was used in the parsed launch arguments.

Returns
true if it was used at least once, false otherwise.

Member Data Documentation

◆ Arguments

readonly List<string> Option.Arguments

List of values given to the Option if it is allowed to have any.
If it isn't allowed to hold any, the list will just be instantiated and empty.

See also
NibblePoker.Library.Arguments.OptionFlags.HasValue, NibblePoker.Library.Arguments.OptionFlags.HasMultipleValue

◆ Description

readonly? string Option.Description

Description as shown in the help text.
Will be treated as non-present, or on empty string if left as null.

◆ Flags

OptionFlags Option.Flags

Binary flags used to toggle some special behavior and conditions during the parsing process.

See also
NibblePoker.Library.Arguments.OptionFlags

◆ Name

readonly? string Option.Name

Name string used when searching for the Option or rendering the help text.
May be left as null to indicate that it has no long name.

◆ Occurrences

int Option.Occurrences

Counter used to indicate how many times the Option was used during the parsing process.

See also
NibblePoker.Library.Arguments.OptionFlags.Repeatable

◆ Token

readonly? char Option.Token

Token character used when searching for the Option or rendering the help text.
May be left as null to indicate that it has no token.

Property Documentation

◆ AllowsVerbsAfter

bool Option.AllowsVerbsAfter
getset

Interacts with the OptionFlags.AllowVerbsAfter flag that may have been given in the constructor, or modified through this property.

◆ CanHaveMultipleValue

bool Option.CanHaveMultipleValue
getset

Interacts with the OptionFlags.HasValue and OptionFlags.Repeatable flags that may have been given in the constructor, or modified through this property.

◆ CanHaveValue

bool Option.CanHaveValue
getset

Interacts with the OptionFlags.HasValue flag that may have been given in the constructor, or modified through this property.

◆ IsDefault

bool Option.IsDefault
getset

Interacts with the OptionFlags.Default flag that may have been given in the constructor, or modified through this property.

◆ IsHidden

bool Option.IsHidden
getset

Interacts with the OptionFlags.Hidden flag that may have been given in the constructor, or modified through this property.

◆ IsRepeatable

bool Option.IsRepeatable
getset

Interacts with the OptionFlags.Repeatable flag that may have been given in the constructor, or modified through this property.

◆ IsRequired

bool Option.IsRequired
getset

Interacts with the OptionFlags.Required flag that may have been given in the constructor, or modified through this property.

◆ ShouldSkipParsingRequirementChecks

bool Option.ShouldSkipParsingRequirementChecks
getset

Interacts with the OptionFlags.SkipsRequiredChecks flag that may have been given in the constructor, or modified through this property.

◆ ShouldStopParsing

bool Option.ShouldStopParsing
getset

Interacts with the OptionFlags.StopsParsing flag that may have been given in the constructor, or modified through this property.


The documentation for this class was generated from the following file: