Search Results for

    Show / Hide Table of Contents

    Class DefaultHelpTextGenerator

    A default implementation of help text generation.

    Inheritance
    System.Object
    DefaultHelpTextGenerator
    Implements
    IHelpTextGenerator
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: McMaster.Extensions.CommandLineUtils.HelpText
    Assembly: McMaster.Extensions.CommandLineUtils.dll
    Syntax
    public class DefaultHelpTextGenerator : IHelpTextGenerator

    Constructors

    | Improve this Doc View Source

    DefaultHelpTextGenerator()

    Initializes a new instance of DefaultHelpTextGenerator.

    Declaration
    protected DefaultHelpTextGenerator()

    Fields

    | Improve this Doc View Source

    ColumnSeparatorLength

    The number of spaces between columns.

    Declaration
    protected const int ColumnSeparatorLength = 2
    Field Value
    Type Description
    System.Int32

    Properties

    | Improve this Doc View Source

    IndentWriter

    The hanging indent writer used for formatting indented and wrapped descriptions for options and arguments.

    Declaration
    protected HangingIndentWriter? IndentWriter { get; set; }
    Property Value
    Type Description
    System.Nullable<HangingIndentWriter>
    | Improve this Doc View Source

    Singleton

    A singleton instance of DefaultHelpTextGenerator.

    Declaration
    public static DefaultHelpTextGenerator Singleton { get; }
    Property Value
    Type Description
    DefaultHelpTextGenerator
    | Improve this Doc View Source

    SortCommandsByName

    Determines if commands are ordered by name in generated help text

    Declaration
    public bool SortCommandsByName { get; set; }
    Property Value
    Type Description
    System.Boolean

    Methods

    | Improve this Doc View Source

    Format(CommandOption)

    Generates the template string in the format "-{Symbol}|-{Short}|--{Long} <{Value}>" for display in help text.

    Declaration
    protected virtual string Format(CommandOption option)
    Parameters
    Type Name Description
    CommandOption option
    Returns
    Type Description
    System.String

    The template string

    | Improve this Doc View Source

    Generate(CommandLineApplication, TextWriter)

    Generate help text for the application.

    Declaration
    public virtual void Generate(CommandLineApplication application, TextWriter output)
    Parameters
    Type Name Description
    CommandLineApplication application
    System.IO.TextWriter output
    | Improve this Doc View Source

    GenerateArguments(CommandLineApplication, TextWriter, IReadOnlyList<CommandArgument>, Int32)

    Generate the lines that show information about arguments

    Declaration
    protected virtual void GenerateArguments(CommandLineApplication application, TextWriter output, IReadOnlyList<CommandArgument> visibleArguments, int firstColumnWidth)
    Parameters
    Type Name Description
    CommandLineApplication application

    The app

    System.IO.TextWriter output

    Help text output

    System.Collections.Generic.IReadOnlyList<CommandArgument> visibleArguments

    Arguments not hidden from help text

    System.Int32 firstColumnWidth

    The width of the first column of commands, arguments, and options

    | Improve this Doc View Source

    GenerateBody(CommandLineApplication, TextWriter)

    Generate detailed help information

    Declaration
    protected virtual void GenerateBody(CommandLineApplication application, TextWriter output)
    Parameters
    Type Name Description
    CommandLineApplication application

    The application

    System.IO.TextWriter output

    Help text output

    | Improve this Doc View Source

    GenerateCommands(CommandLineApplication, TextWriter, IReadOnlyList<CommandLineApplication>, Int32)

    Generate the lines that show information about subcommands

    Declaration
    protected virtual void GenerateCommands(CommandLineApplication application, TextWriter output, IReadOnlyList<CommandLineApplication> visibleCommands, int firstColumnWidth)
    Parameters
    Type Name Description
    CommandLineApplication application

    The app

    System.IO.TextWriter output

    Help text output

    System.Collections.Generic.IReadOnlyList<CommandLineApplication> visibleCommands

    Commands not hidden from help text

    System.Int32 firstColumnWidth

    The width of the first column of commands, arguments, and options

    | Improve this Doc View Source

    GenerateFooter(CommandLineApplication, TextWriter)

    Generate the last lines of help text output

    Declaration
    protected virtual void GenerateFooter(CommandLineApplication application, TextWriter output)
    Parameters
    Type Name Description
    CommandLineApplication application

    The app

    System.IO.TextWriter output

    Help text output

    | Improve this Doc View Source

    GenerateHeader(CommandLineApplication, TextWriter)

    Generate the first few lines of help output text

    Declaration
    protected virtual void GenerateHeader(CommandLineApplication application, TextWriter output)
    Parameters
    Type Name Description
    CommandLineApplication application

    The app

    System.IO.TextWriter output

    Help text output

    | Improve this Doc View Source

    GenerateOptions(CommandLineApplication, TextWriter, IReadOnlyList<CommandOption>, Int32)

    Generate the lines that show information about options

    Declaration
    protected virtual void GenerateOptions(CommandLineApplication application, TextWriter output, IReadOnlyList<CommandOption> visibleOptions, int firstColumnWidth)
    Parameters
    Type Name Description
    CommandLineApplication application

    The app

    System.IO.TextWriter output

    Help text output

    System.Collections.Generic.IReadOnlyList<CommandOption> visibleOptions

    Options not hidden from help text

    System.Int32 firstColumnWidth

    The width of the first column of commands, arguments, and options

    | Improve this Doc View Source

    GenerateUsage(CommandLineApplication, TextWriter, IReadOnlyList<CommandArgument>, IReadOnlyList<CommandOption>, IReadOnlyList<CommandLineApplication>)

    Generate the line that shows usage

    Declaration
    protected virtual void GenerateUsage(CommandLineApplication application, TextWriter output, IReadOnlyList<CommandArgument> visibleArguments, IReadOnlyList<CommandOption> visibleOptions, IReadOnlyList<CommandLineApplication> visibleCommands)
    Parameters
    Type Name Description
    CommandLineApplication application

    The app

    System.IO.TextWriter output

    Help text output

    System.Collections.Generic.IReadOnlyList<CommandArgument> visibleArguments

    Arguments not hidden from help text

    System.Collections.Generic.IReadOnlyList<CommandOption> visibleOptions

    Options not hidden from help text

    System.Collections.Generic.IReadOnlyList<CommandLineApplication> visibleCommands

    Commands not hidden from help text

    Implements

    IHelpTextGenerator
    • Improve this Doc
    • View Source
    In This Article
    Back to top