Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DefaultHelpGenerator

Imperative default help generator. Accepts the command definitions and constructs the full help text for the command node.

TODO - Consider removing word wrap on a fixed with and apply dynamically based on terminal sizes

export

Hierarchy

Implements

Index

Constructors

constructor

Properties

Protected groupToOption

groupToOption: {}

A map of group names to option names and aliases - useful in help text/doc generation e.g. this.grouptoOption["job options"] -> [ "--async | -a ", "--activate | -A"]

Type declaration

  • [key: string]: string[]

Protected mCommandDefinition

mCommandDefinition: ICommandDefinition

The command definition for which we are building help

Protected mDefinitionTree

mDefinitionTree: ICommandDefinition

The full command definition - which includes the parents of the command.

Protected mExperimentalCommandDescription

mExperimentalCommandDescription: string = Constants.DEFAULT_EXPERIMENTAL_COMMAND_EXPLANATION

The configured experimental command description. Has a default, generic description which can be overridden through parameters to the constructor

Protected mLog

mLog: Logger

Logger

Protected mPrimaryHighlightColor

mPrimaryHighlightColor: string

Protected mProduceMarkdown

mProduceMarkdown: boolean = false

Produce markdown - not help text.

Protected mRootCommandName

mRootCommandName: string

The command name being invoked by the user. For example, when using "banana --help", banana is the command name.

Protected optionToDescription

optionToDescription: {}

A map of option names and aliases to their descriptions - useful in help text/doc generation e.g. this.optionToDescription["--async | a"] -> "Don't wait for this job to complete before returning"

Type declaration

  • [key: string]: string

Private skipTextWrap

skipTextWrap: boolean = false

Indicates that the help generator should skip introducing breaks based on terminal width

memberof

IHelpGeneratorParms

Static Private Readonly ERROR_TAG

ERROR_TAG: string = "Help Generator Error:"

Standard imperative error message tag for errors thrown by the help generator

static
memberof

DefaultHelpGenerator

Static Readonly HELP_INDENT

HELP_INDENT: " " = " "

The help indent for spacing/alignment

static
memberof

DefaultHelpGenerator

Static LONG_DASH

LONG_DASH: string = "--"

Static SHORT_DASH

SHORT_DASH: string = "-"

Accessors

Protected log

Methods

buildChildrenSummaryTables

  • buildChildrenSummaryTables(): string

buildCommandAndAliases

buildCommandOptionsSection

  • buildCommandOptionsSection(): string

buildDescriptionSection

  • buildDescriptionSection(): string

buildExamplesSection

  • buildExamplesSection(): string
  • Build the examples text for the command. Examples include the command example (which normally is able to be copy/pasted verbatim) and the description for the example. TODO - we should remove wordwrap from this

    memberof

    DefaultHelpGenerator

    Returns string

    • The example text

buildFullCommandHelpText

  • buildFullCommandHelpText(includeGlobalOptions?: boolean): string

buildFullGroupHelpText

  • buildFullGroupHelpText(): string
  • Build the help text for a "group" - a group has a set of children The help text contains the standard description/usage/etc., but unlike a command only displays the next set of "commands" or "groups" that can be issued after the current node.

    memberof

    DefaultHelpGenerator

    Returns string

    • the full group help text

buildGlobalOptionsSection

  • buildGlobalOptionsSection(): string

buildHeader

  • buildHeader(header: string): string

buildHelp

  • buildHelp(): string

Protected buildOptionMaps

  • buildOptionMaps(): void

buildOptionText

  • buildOptionText(optionString: string, description: string): string

buildPositionalArgumentsSection

  • buildPositionalArgumentsSection(): string

buildUsageDiagram

  • buildUsageDiagram(): string

buildUsageSection

  • buildUsageSection(): string

Protected dimGrey

  • dimGrey(text: string): any

Private escapeMarkdown

  • escapeMarkdown(text: string): string

Protected explainType

Protected getCaseSensitiveFlagByOptionName

  • getCaseSensitiveFlagByOptionName(optionName: string): boolean

getExperimentalCommandSection

  • getExperimentalCommandSection(): string

getOptionAndAliasesString

Protected grey

  • grey(text: string): any

Protected renderHelp

  • renderHelp(help: string): string

Static formatHelpHeader

  • formatHelpHeader(header: string, indent?: string, color: string): string

Generated using TypeDoc