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
NibblePoker.Library.Arguments.HelpText Class Reference

Static class that contains helpers related to printing a help text. More...

Static Public Member Functions

static string SplitToMultiline (string inputText, int maxLineLength, string sequentialPrefix)
 Splits a given text in a series of lines with a given line prefix that fit in a given width. More...
 
static string GetOptionUsagePart (Option option)
 Processes a given Option and returns the usage part in POSIX format. More...
 
static string GetOptionDetailsPart (Option option, uint shortOptionSpace=0, bool addValueToShort=false)
 Processes a given Option and returns the details part. More...
 
static List< string > GetUsageLines (Verb verb, string programName, uint consoleWidth=80, bool addVerbs=true)
 Processes a given Verb to get the associated usage text in POSIX format as a list of lines. More...
 
static string GetUsageString (Verb verb, string programName, uint consoleWidth=80, bool addVerbs=true)
 Processes a given Verb to get the associated usage text in POSIX format. More...
 
static List< string > GetOptionsDetailsLines (Verb verb, uint consoleWidth=80, uint leftSpace=2, uint innerSpace=2, bool addValueToShort=false)
 Processes a given Verb to get the associated Options' details text in POSIX format as a list. More...
 
static string GetOptionsDetails (Verb verb, uint consoleWidth=80, uint leftSpace=2, uint innerSpace=2, bool addValueToShort=false)
 Processes a given Verb to get the associated Options' details text in POSIX format. More...
 
static string GetVerbsDetails (Verb verb, uint consoleWidth=80, uint leftSpace=2, uint innerSpace=2)
 Retrieves the sub-Verbs's details section for the given Verbs. More...
 
static string GetFullHelpText (Verb verb, string programName, uint consoleWidth=80, uint leftSpace=2, uint innerSpace=2, bool addVerbs=true)
 Retrieves the complete help text with the usage and verb/options info and description. More...
 

Detailed Description

Static class that contains helpers related to printing a help text.

Member Function Documentation

◆ GetFullHelpText()

static string NibblePoker.Library.Arguments.HelpText.GetFullHelpText ( Verb  verb,
string  programName,
uint  consoleWidth = 80,
uint  leftSpace = 2,
uint  innerSpace = 2,
bool  addVerbs = true 
)
inlinestatic

Retrieves the complete help text with the usage and verb/options info and description.

Parameters
verbThe Verb for which the help text should be rendered.
programNameExecutable's name to use in the usage text.
consoleWidthThe console width used to calculate properly formatted and spaced line returns.
leftSpaceAmount of spaces for any non-heading text in the Verb and Option sections.
innerSpaceAmount of spaces between the Verb and Option and their description.
addVerbsToggle to include or exclude the Verb section.
Returns
The complete help text as a string.

It is recommended to subtract 1 from the console's max width to prevent weird and unexpected line returns in some command prompts.

◆ GetOptionDetailsPart()

static string NibblePoker.Library.Arguments.HelpText.GetOptionDetailsPart ( Option  option,
uint  shortOptionSpace = 0,
bool  addValueToShort = false 
)
inlinestatic

Processes a given Option and returns the details part.

Parameters
optionThe Option to process.
shortOptionSpaceAmount of spaces used by short options in other lines, must include the inner comma and space.
addValueToShortAdd the value's name part to both the short version if both short and long options are available.
Returns
The formatted text as a string.

◆ GetOptionsDetails()

static string NibblePoker.Library.Arguments.HelpText.GetOptionsDetails ( Verb  verb,
uint  consoleWidth = 80,
uint  leftSpace = 2,
uint  innerSpace = 2,
bool  addValueToShort = false 
)
inlinestatic

Processes a given Verb to get the associated Options' details text in POSIX format.

Parameters
verbThe Verb for which the help text should be rendered.
consoleWidthThe console width used to calculate properly formatted and spaced line returns.
leftSpaceAmount of spaces for any non-heading text.
innerSpaceAmount of spaces between the Option and their description.
addValueToShortToggle to add the value's name part to both the short version if both short and long Options are available.
Returns
The Options' details as a single string with line returns.

It is recommended to subtract 1 from the console's max width to prevent weird and unexpected line returns in some command prompts.

◆ GetOptionsDetailsLines()

static List< string > NibblePoker.Library.Arguments.HelpText.GetOptionsDetailsLines ( Verb  verb,
uint  consoleWidth = 80,
uint  leftSpace = 2,
uint  innerSpace = 2,
bool  addValueToShort = false 
)
inlinestatic

Processes a given Verb to get the associated Options' details text in POSIX format as a list.

Parameters
verbThe Verb for which the help text should be rendered.
consoleWidthThe console width used to calculate properly formatted and spaced line returns.
leftSpaceAmount of spaces for any non-heading text.
innerSpaceAmount of spaces between the Option and their description.
addValueToShortAdd the value's name part to both the short version if both short and long options are available.
Returns
The Options' details as a list of strings.

It is recommended to subtract 1 from the console's max width to prevent weird and unexpected line returns in some command prompts.

◆ GetOptionUsagePart()

static string NibblePoker.Library.Arguments.HelpText.GetOptionUsagePart ( Option  option)
inlinestatic

Processes a given Option and returns the usage part in POSIX format.

Parameters
optionThe Option to process.
Returns
The formatted text as a string.

◆ GetUsageLines()

static List< string > NibblePoker.Library.Arguments.HelpText.GetUsageLines ( Verb  verb,
string  programName,
uint  consoleWidth = 80,
bool  addVerbs = true 
)
inlinestatic

Processes a given Verb to get the associated usage text in POSIX format as a list of lines.

Parameters
verbThe Verb for which the help text should be rendered.
programNameExecutable's name to use.
consoleWidthThe console width used to calculate properly formatted and spaced line returns.
addVerbsToggle to include or exclude the Verb from the output.
Returns
The formatted lines as a list.

It is recommended to subtract 1 from the console's max width to prevent weird and unexpected line returns in some command prompts.

◆ GetUsageString()

static string NibblePoker.Library.Arguments.HelpText.GetUsageString ( Verb  verb,
string  programName,
uint  consoleWidth = 80,
bool  addVerbs = true 
)
inlinestatic

Processes a given Verb to get the associated usage text in POSIX format.

Parameters
verbThe Verb for which the help text should be rendered.
programNameExecutable's name to use.
consoleWidthThe console width used to calculate properly formatted and spaced line returns.
addVerbsToggle to include or exclude the Verb from the output.
Returns
The formatted lines as a string with line returns.

It is recommended to subtract 1 from the console's max width to prevent weird and unexpected line returns in some command prompts.

◆ GetVerbsDetails()

static string NibblePoker.Library.Arguments.HelpText.GetVerbsDetails ( Verb  verb,
uint  consoleWidth = 80,
uint  leftSpace = 2,
uint  innerSpace = 2 
)
inlinestatic

Retrieves the sub-Verbs's details section for the given Verbs.

Parameters
verbThe Verbs for which the help text should be rendered.
consoleWidthThe console width used to calculate properly formatted and spaced line returns.
leftSpaceAmount of spaces for any non-heading text.
innerSpaceAmount of spaces between the Verbs and their description.
Returns
The Verb' sub-Verbs' details as a single string with line returns.

It is recommended to subtract 1 from the console's max width to prevent weird and unexpected line returns in some command prompts.

◆ SplitToMultiline()

static string NibblePoker.Library.Arguments.HelpText.SplitToMultiline ( string  inputText,
int  maxLineLength,
string  sequentialPrefix 
)
inlinestatic

Splits a given text in a series of lines with a given line prefix that fit in a given width.

Parameters
inputTextText to split.
maxLineLengthMaximum line length.
sequentialPrefixPrefix text to use for any split line.
Returns
The split text as a single string.

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