UsageWriter Class

Creates usage help for the CommandLineParser class and the CommandManager class.

Definition

Namespace: Ookii.CommandLine
Assembly: Ookii.CommandLine (in Ookii.CommandLine.dll) Version: 4.0.0+bb7ed9a8fdfd1cb21824750a8cf508863ad15086
C#
public class UsageWriter
Inheritance
Object    UsageWriter

Remarks

You can derive from this class to override the formatting of various aspects of the usage help. Set the ParseOptionsUsageWriter property to specify a custom instance.

Depending on what methods you override, you can change small parts of the formatting, or completely change how usage looks. Certain methods may not be called if you override the methods that call them.

This class has a number of properties that customize the usage help for the base implementation of this class. It is not guaranteed that a derived class will respect these properties.

Constructors

UsageWriter Initializes a new instance of the UsageWriter class.

Properties

ApplicationDescriptionIndent The indentation to use for the application description.
ArgumentDescriptionColor Gets or sets the color applied by the WriteArgumentDescription(CommandLineArgument) method.
ArgumentDescriptionIndent Gets or sets the number of characters by which to indent all but the first line of each argument's description, if the CommandLineParserMode property is ParsingModeDefault.
ArgumentDescriptionListFilter Gets or sets a value that indicates which arguments should be included in the list of argument descriptions.
ArgumentDescriptionListOrder Gets or sets a value that indicates the order of the arguments in the list of argument descriptions.
BlankLineAfterCommandDescription Gets or sets a value indicating whether the WriteCommandDescription(CommandInfo) method will write a blank line between commands in the command list.
BlankLineAfterDescription Gets or sets a value indicating whether the WriteArgumentDescription(CommandLineArgument) method will write a blank line between arguments in the description list.
ColorReset Gets or sets the virtual terminal sequence used to undo a color change that was applied to a usage help element.
CommandDescriptionColor Gets or sets the color applied by the base implementation of the WriteCommandDescription(CommandInfo) method.
CommandDescriptionIndent Gets or sets the number of characters by which to indent the all but the first line of command descriptions.
CommandManager Gets the CommandManager that usage is being written for.
CommandName Gets or sets the name of the subcommand.
ExecutableName Gets or sets the application executable name used in the usage help.
IncludeAliasInDescription Gets or sets a value indicating whether the alias or aliases of an argument should be included in the argument description..
IncludeApplicationDescription Gets or sets a value indicating whether the value of the CommandLineParserDescription property is written before the syntax.
IncludeApplicationDescriptionBeforeCommandList Gets or sets a value that indicates whether to show the application description before the command list in the usage help.
IncludeCommandAliasInCommandList Gets or sets a value that indicates whether to show a command's aliases as part of the command list usage help.
IncludeCommandHelpInstruction Gets or sets a value that indicates whether a message is shown at the bottom of the command list that instructs the user how to get help for individual commands.
IncludeDefaultValueInDescription Gets or sets a value indicating whether the default value of an argument should be included in the argument description.
IncludeExecutableExtension Gets or sets a value that indicates whether the usage syntax should include the file name extension of the application's executable.
IncludeValidatorsInDescription Gets or sets a value indicating whether the ArgumentValidationAttribute attributes of an argument should be included in the argument description.
NameSeparator Gets the separator used between multiple consecutive argument names, command names, and aliases in the usage help.
OperationInProgress Indicates what operation is currently in progress.
Parser Gets the CommandLineParser that usage is being written for.
ShouldIndent Gets a value that indicates whether indentation should be enabled in the output.
SyntaxIndent Gets or sets the number of characters by which to indent all except the first line of the command line syntax of the usage help.
UsagePrefixColor Gets or sets the color applied by the WriteUsageSyntaxPrefix method.
UseAbbreviatedSyntax Gets or sets a value that indicates whether to list only positional arguments in the usage syntax.
UseColor Gets or sets a value that indicates whether the usage help should use color.
UseShortNamesForSyntax Gets or sets a value that indicates whether the usage syntax should use short names for arguments that have one.
UseWhiteSpaceValueSeparator Gets or sets a value indicating whether white space, rather than the first element of the CommandLineParserNameValueSeparators property, is used to separate arguments and their values in the command line syntax.
Writer Gets the LineWrappingTextWriter to which the usage should be written.

Methods

EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetArgumentsInDescriptionOrder Gets the parser's arguments filtered according to the ArgumentDescriptionListFilter property and sorted according to the ArgumentDescriptionListOrder property.
GetArgumentsInUsageOrder Gets the arguments in the order they will be shown in the usage syntax.
GetCommandListUsage Returns a string with usage help for the specified command manager.
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
GetUsage Returns a string with usage help for the specified parser.
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
ResetColor Returns the output color to the value before modifications, if color is enabled.
SetIndent Sets the indentation of the Writer, only if the ShouldIndent property returns .
ToStringReturns a string that represents the current object.
(Inherited from Object)
Write(Char) Writes a character to the Writer.
Write(String) Writes a string to the Writer.
WriteAbbreviatedRemainingArguments Writes the string used to indicate there are more arguments if the usage syntax was abbreviated.
WriteAlias Writes a single alias for use in the argument description list.
WriteAliases Writes the aliases of an argument for use in the argument description list.
WriteApplicationDescription Writes the application description, or command description in case of a subcommand.
WriteArgumentDescription(CommandLineArgument) Writes the description of a single argument.
WriteArgumentDescription(String) Writes the actual argument description text.
WriteArgumentDescriptionBody Writes the body of an argument description, which is usually the description itself with any supplemental information.
WriteArgumentDescriptionHeader Writes the header of an argument's description, which is usually the name and value description.
WriteArgumentDescriptionListHeader Writes a header before the list of argument descriptions.
WriteArgumentDescriptions Writes the list of argument descriptions.
WriteArgumentName Writes the name of an argument.
WriteArgumentNameForDescription Writes the name or alias of an argument for use in the argument description list.
WriteArgumentSyntax Writes the syntax for a single argument.
WriteArgumentValidators Writes the help message of any ArgumentValidationAttribute attributes applied to the argument.
WriteAvailableCommandsHeader Writes a header before the list of available commands.
WriteClassValidators Writes the help messages for any ClassValidationAttribute attributes applied to the arguments class.
WriteColor Writes a string with virtual terminal sequences only if color is enabled.
WriteCommandAliases Writes the aliases of a command.
WriteCommandDescription(CommandInfo) Writes the description of a command.
WriteCommandDescription(String) Writes the description text of a command.
WriteCommandDescriptionBody Writes the body of a command's description, which is typically the description of the command.
WriteCommandDescriptionHeader Writes the header of a command's description, which is typically the name and alias(es) of the command.
WriteCommandDescriptions Writes a list of available commands.
WriteCommandHelpInstruction Writes an instruction on how to get help on a command.
WriteCommandListUsage Creates usage help for the specified command manager.
WriteCommandListUsageCore Creates the usage help for a Ookii.CommandLine.CommandsCommandManager instance.
WriteCommandListUsageSyntax Writes the usage syntax for an application using subcommands.
WriteCommandName Writes the name of a command.
WriteDefaultValue Writes the default value of an argument.
WriteLine Writes a new line to the Writer.
WriteMoreInfoMessage Writes a message telling to user how to get more detailed help.
WriteMultiValueSuffix Writes a suffix that indicates an argument is a multi-value argument.
WriteOptionalArgumentSyntax Writes the syntax for a single optional argument.
WriteParserUsage Creates usage help for the specified parser.
WriteParserUsageCore Creates the usage help for a CommandLineParser instance.
WriteParserUsageSyntax Writes the usage syntax for the application or subcommand.
WritePositionalArgumentName Writes the name of a positional argument.
WriteSpacing Writes the specified amount of spaces to the Writer.
WriteSwitchValueDescription Writes the value description of a switch argument for use in the argument description list.
WriteUsageSyntaxPrefix Write the prefix for the usage syntax, including the executable name and, for subcommands, the command name.
WriteUsageSyntaxSuffix Write the suffix for the usage syntax.
WriteValueDescription Writes the value description of an argument.
WriteValueDescriptionForDescription Writes the value description of an argument for use in the argument description list.

Fields

DefaultApplicationDescriptionIndent The default indentation for the application description.
DefaultArgumentDescriptionIndent The default indentation for the argument descriptions.
DefaultCommandDescriptionIndent Gets the default value for the CommandDescriptionIndent property.
DefaultSyntaxIndent The default indentation for the usage syntax.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also