CommandLine
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Public Member Functions | Static Public Member Functions | Properties | List of all members
CommandLine.Text.HelpText Class Reference

Provides means to format an help screen. You can assign it in place of a System.String instance. More...

Public Member Functions

 HelpText ()
 Initializes a new instance of the CommandLine.Text.HelpText class. More...
 
 HelpText (SentenceBuilder sentenceBuilder)
 Initializes a new instance of the CommandLine.Text.HelpText class specifying the sentence builder. More...
 
 HelpText (string heading)
 Initializes a new instance of the CommandLine.Text.HelpText class specifying heading string. More...
 
 HelpText (SentenceBuilder sentenceBuilder, string heading)
 Initializes a new instance of the CommandLine.Text.HelpText class specifying the sentence builder and heading string. More...
 
 HelpText (string heading, string copyright)
 Initializes a new instance of the CommandLine.Text.HelpText class specifying heading and copyright strings. More...
 
 HelpText (SentenceBuilder sentenceBuilder, string heading, string copyright)
 Initializes a new instance of the CommandLine.Text.HelpText class specifying heading and copyright strings. More...
 
HelpText AddPreOptionsLine (string value)
 Adds a text line after copyright and before options usage strings. More...
 
HelpText AddPostOptionsLine (string value)
 Adds a text line at the bottom, after options usage string. More...
 
HelpText AddOptions< T > (T options)
 Adds a text block with options usage string. More...
 
HelpText AddVerbs (params Type[] types)
 Adds a text block with verbs usage string. More...
 
HelpText AddOptions< T > (int maximumLength, T options)
 Adds a text block with options usage string. More...
 
HelpText AddVerbs (int maximumLength, params Type[] types)
 Adds a text block with verbs usage string. More...
 
override string ToString ()
 Returns the help screen as a System.String. More...
 

Static Public Member Functions

static HelpText AutoBuild< T > (ParserResult< T > parserResult, Func< HelpText, HelpText > onError, bool verbsIndex=false)
 Creates a new instance of the CommandLine.Text.HelpText class using common defaults. More...
 
static HelpText AutoBuild< T > (ParserResult< T > parserResult)
 Creates a new instance of the CommandLine.Text.HelpText class, automatically handling verbs or options scenario. More...
 
static HelpText DefaultParsingErrorsHandler< T > (ParserResult< T > parserResult, HelpText current)
 Supplies a default parsing error handler implementation. More...
 
static implicit operator string (HelpText info)
 Converts the help instance to a System.String. More...
 
static string RenderParsingErrorsText< T > (ParserResult< T > parserResult, Func< Error, string > formatError, int indent)
 Builds a string that contains a parsing error message. More...
 

Properties

string Heading [get, set]
 Gets or sets the heading string. You can directly assign a CommandLine.Text.HeadingInfo instance. More...
 
string Copyright [get, set]
 Gets or sets the copyright string. You can directly assign a CommandLine.Text.CopyrightInfo instance. More...
 
int MaximumDisplayWidth [get, set]
 Gets or sets the maximum width of the display. This determines word wrap when displaying the text. More...
 
bool AddDashesToOption [get, set]
 Gets or sets a value indicating whether the format of options should contain dashes. It modifies behavior of AddOptions{T}(T) method. More...
 
bool AdditionalNewLineAfterOption [get, set]
 Gets or sets a value indicating whether to add an additional line after the description of the option. More...
 
bool AddEnumValuesToHelpText [get, set]
 Gets or sets a value indicating whether to add the values of an enum after the description of the option. More...
 
SentenceBuilder SentenceBuilder [get]
 Gets the SentenceBuilder instance specified in constructor. More...
 

Detailed Description

Provides means to format an help screen. You can assign it in place of a System.String instance.

Constructor & Destructor Documentation

CommandLine.Text.HelpText.HelpText ( )
inline

Initializes a new instance of the CommandLine.Text.HelpText class.

CommandLine.Text.HelpText.HelpText ( SentenceBuilder  sentenceBuilder)
inline

Initializes a new instance of the CommandLine.Text.HelpText class specifying the sentence builder.

Parameters
sentenceBuilderA SentenceBuilder instance.
CommandLine.Text.HelpText.HelpText ( string  heading)
inline

Initializes a new instance of the CommandLine.Text.HelpText class specifying heading string.

Parameters
headingAn heading string or an instance of CommandLine.Text.HeadingInfo.
Exceptions
System.ArgumentExceptionThrown when parameter heading is null or empty string.
CommandLine.Text.HelpText.HelpText ( SentenceBuilder  sentenceBuilder,
string  heading 
)
inline

Initializes a new instance of the CommandLine.Text.HelpText class specifying the sentence builder and heading string.

Parameters
sentenceBuilderA SentenceBuilder instance.
headingA string with heading or an instance of CommandLine.Text.HeadingInfo.
CommandLine.Text.HelpText.HelpText ( string  heading,
string  copyright 
)
inline

Initializes a new instance of the CommandLine.Text.HelpText class specifying heading and copyright strings.

Parameters
headingA string with heading or an instance of CommandLine.Text.HeadingInfo.
copyrightA string with copyright or an instance of CommandLine.Text.CopyrightInfo.
Exceptions
System.ArgumentNullExceptionThrown when one or more parameters are null or empty strings.
CommandLine.Text.HelpText.HelpText ( SentenceBuilder  sentenceBuilder,
string  heading,
string  copyright 
)
inline

Initializes a new instance of the CommandLine.Text.HelpText class specifying heading and copyright strings.

Parameters
sentenceBuilderA SentenceBuilder instance.
headingA string with heading or an instance of CommandLine.Text.HeadingInfo.
copyrightA string with copyright or an instance of CommandLine.Text.CopyrightInfo.
Exceptions
System.ArgumentNullExceptionThrown when one or more parameters are null or empty strings.

Member Function Documentation

HelpText CommandLine.Text.HelpText.AddOptions< T > ( options)
inline

Adds a text block with options usage string.

Parameters
optionsThe instance that collected command line arguments parsed with Parser class.
Exceptions
System.ArgumentNullExceptionThrown when parameter options is null.
HelpText CommandLine.Text.HelpText.AddOptions< T > ( int  maximumLength,
options 
)
inline

Adds a text block with options usage string.

Parameters
maximumLengthThe maximum length of the help screen.
optionsThe instance that collected command line arguments parsed with the Parser class.
Exceptions
System.ArgumentNullExceptionThrown when parameter options is null.
HelpText CommandLine.Text.HelpText.AddPostOptionsLine ( string  value)
inline

Adds a text line at the bottom, after options usage string.

Parameters
valueA System.String instance.
Exceptions
System.ArgumentNullExceptionThrown when parameter value is null or empty string.
HelpText CommandLine.Text.HelpText.AddPreOptionsLine ( string  value)
inline

Adds a text line after copyright and before options usage strings.

Parameters
valueA System.String instance.
Exceptions
System.ArgumentNullExceptionThrown when parameter value is null or empty string.
HelpText CommandLine.Text.HelpText.AddVerbs ( params Type[]  types)
inline

Adds a text block with verbs usage string.

Parameters
typesThe array of System.Type with verb commands.
Exceptions
System.ArgumentNullExceptionThrown when parameter types is null.
System.ArgumentOutOfRangeExceptionThrown if types array is empty.
HelpText CommandLine.Text.HelpText.AddVerbs ( int  maximumLength,
params Type[]  types 
)
inline

Adds a text block with verbs usage string.

Parameters
maximumLengthThe maximum length of the help screen.
typesThe array of System.Type with verb commands.
Exceptions
System.ArgumentNullExceptionThrown when parameter types is null.
System.ArgumentOutOfRangeExceptionThrown if types array is empty.
static HelpText CommandLine.Text.HelpText.AutoBuild< T > ( ParserResult< T >  parserResult,
Func< HelpText, HelpText onError,
bool  verbsIndex = false 
)
inlinestatic

Creates a new instance of the CommandLine.Text.HelpText class using common defaults.

Returns
An instance of CommandLine.Text.HelpText class.
Parameters
parserResultThe CommandLine.ParserResult{T} containing the instance that collected command line arguments parsed with CommandLine.Parser class.
onErrorA delegate used to customize the text block of reporting parsing errors text block.
verbsIndexIf true the output style is consistent with verb commands (no dashes), otherwise it outputs options.

The parameter verbsIndex is not ontly a metter of formatting, it controls whether to handle verbs or options.

static HelpText CommandLine.Text.HelpText.AutoBuild< T > ( ParserResult< T >  parserResult)
inlinestatic

Creates a new instance of the CommandLine.Text.HelpText class, automatically handling verbs or options scenario.

Parameters
parserResultThe CommandLine.ParserResult{T} containing the instance that collected command line arguments parsed with CommandLine.Parser class.
Returns
An instance of CommandLine.Text.HelpText class.

This feature is meant to be invoked automatically by the parser, setting the HelpWriter property of CommandLine.ParserSettings.

static HelpText CommandLine.Text.HelpText.DefaultParsingErrorsHandler< T > ( ParserResult< T >  parserResult,
HelpText  current 
)
inlinestatic

Supplies a default parsing error handler implementation.

Parameters
parserResultThe CommandLine.ParserResult{T} containing the instance that collected command line arguments parsed with CommandLine.Parser class.
currentThe CommandLine.Text.HelpText instance.
static implicit CommandLine.Text.HelpText.operator string ( HelpText  info)
inlinestatic

Converts the help instance to a System.String.

Parameters
infoThis CommandLine.Text.HelpText instance.
Returns
The System.String that contains the help screen.
static string CommandLine.Text.HelpText.RenderParsingErrorsText< T > ( ParserResult< T >  parserResult,
Func< Error, string >  formatError,
int  indent 
)
inlinestatic

Builds a string that contains a parsing error message.

Parameters
parserResultThe CommandLine.ParserResult{T} containing the instance that collected command line arguments parsed with CommandLine.Parser class.
formatErrorThe error formatting delegate.
indentNumber of spaces used to indent text.
Returns
The System.String that contains the parsing error message.
override string CommandLine.Text.HelpText.ToString ( )
inline

Returns the help screen as a System.String.

Returns
The System.String that contains the help screen.

Property Documentation

bool CommandLine.Text.HelpText.AddDashesToOption
getset

Gets or sets a value indicating whether the format of options should contain dashes. It modifies behavior of AddOptions{T}(T) method.

bool CommandLine.Text.HelpText.AddEnumValuesToHelpText
getset

Gets or sets a value indicating whether to add the values of an enum after the description of the option.

bool CommandLine.Text.HelpText.AdditionalNewLineAfterOption
getset

Gets or sets a value indicating whether to add an additional line after the description of the option.

string CommandLine.Text.HelpText.Copyright
getset

Gets or sets the copyright string. You can directly assign a CommandLine.Text.CopyrightInfo instance.

string CommandLine.Text.HelpText.Heading
getset

Gets or sets the heading string. You can directly assign a CommandLine.Text.HeadingInfo instance.

int CommandLine.Text.HelpText.MaximumDisplayWidth
getset

Gets or sets the maximum width of the display. This determines word wrap when displaying the text.

The maximum width of the display.

SentenceBuilder CommandLine.Text.HelpText.SentenceBuilder
get

Gets the SentenceBuilder instance specified in constructor.


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