getopt.net
A port of getopt in pure C#.
|
Static Public Member Functions | |
static ? Option | FindOptionOrDefault (this Option[] list, string optName) |
Finds an option with the name optName | |
static ? Option | FindOptionOrDefault (this Option[]? list, char optVal) |
Finds an option in the list list with the Option.Value optVal . | |
static string | ToShortOptString (this Option[] list) |
Creates a short opt string from an array of Option objects. | |
static string | ToShortOptString (this Option[] list, OptStringPrefix prefix) |
Creates a short opt string from an array of Option objects. | |
static string | GenerateHelpText (this GetOpt getopt, HelpTextConfig? generatorOptions=null) |
Generates a help text from the arguments contained in getopt . See GetOpt.Options for more information. The method also takes a HelpTextConfig object to generate a help text. (generatorOptions ) If generatorOptions is null, it will be assigned the value HelpTextConfig.Default. | |
static string | GetApplicationName () |
Gets the name of the application. | |
This class contains extension methods specific to getopt.net. If these extension methods help you in your program, you're free to use them too!
Definition at line 32 of file Extensions.cs.
|
inlinestatic |
Finds an option with the name optName
list | The list of options to search. |
optName | The name of the argument to search for. |
Definition at line 40 of file Extensions.cs.
References getopt.net.Option.Name.
|
static |
Finds an option in the list list with the Option.Value optVal .
list | The list of options to search. |
optVal | The value to search for. |
|
inlinestatic |
Generates a help text from the arguments contained in getopt . See GetOpt.Options for more information. The method also takes a HelpTextConfig object to generate a help text. (generatorOptions ) If generatorOptions is null, it will be assigned the value HelpTextConfig.Default.
The help text is generated in the following format: programName programVersion
Usage: programName [options]
Switches: ...
Options: ...
footerText
If HelpTextConfig.ApplicationName or HelpTextConfig.ApplicationVersion is null or empty, the first line will be omitted and the assembly name will be used in the usage. If HelpTextConfig.FooterText is null or empty, the footer will be omitted.
The switches section will only contain options with the ArgumentType set to ArgumentType.None. The options section will only contain options with the ArgumentType set to ArgumentType.Optional or ArgumentType.Required.
Each line containing the description of an option will be formatted as follows: -s, –long-switch Description of the switch
where the lines will be justified to the longest name.
getopt | The instance of GetOpt to use. |
generatorOptions | (Optional) Customised generator configuration. |
Definition at line 136 of file Extensions.cs.
References getopt.net.HelpTextConfig.Default.
|
inlinestatic |
Gets the name of the application.
Definition at line 228 of file Extensions.cs.
|
inlinestatic |
Creates a short opt string from an array of Option objects.
list | The options to convert. |
Definition at line 59 of file Extensions.cs.
|
inlinestatic |
Creates a short opt string from an array of Option objects.
list | The options to convert. |
prefix | The prefix to use for the shortopt string. |
Definition at line 86 of file Extensions.cs.