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

- AbstractHelpGenerator
  - DefaultHelpGenerator

### Implements

- IHelpGenerator

## Index

### Constructors

- constructor

### Properties

- groupToOption
- mCommandDefinition
- mDefinitionTree
- mExperimentalCommandDescription
- mLog
- mPrimaryHighlightColor
- mProduceMarkdown
- mRootCommandName
- optionToDescription
- skipTextWrap
- ERROR_TAG
- HELP_INDENT
- LONG_DASH
- SHORT_DASH

### Accessors

- log

### Methods

- buildChildrenSummaryTables
- buildCommandAndAliases
- buildCommandOptionsSection
- buildDescriptionSection
- buildExamplesSection
- buildFullCommandHelpText
- buildFullGroupHelpText
- buildGlobalOptionsSection
- buildHeader
- buildHelp
- buildOptionMaps
- buildOptionText
- buildPositionalArgumentsSection
- buildUsageDiagram
- buildUsageSection
- dimGrey
- escapeMarkdown
- explainType
- getCaseSensitiveFlagByOptionName
- getExperimentalCommandSection
- getOptionAndAliasesString
- grey
- renderHelp
- formatHelpHeader

## Constructors

### constructor

- new DefaultHelpGenerator(defaultParms: IHelpGeneratorFactoryParms, commandParms: IHelpGeneratorParms): DefaultHelpGenerator

- Overrides AbstractHelpGenerator.constructor

  - Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:55

  Creates an instance of DefaultHelpGenerator.

  memberof

    DefaultHelpGenerator

  #### Parameters

  - ##### defaultParms: IHelpGeneratorFactoryParms

    Imperative config parameters for help generation - See interface for details

  - ##### commandParms: IHelpGeneratorParms

    The command definitions for generating help - See interface for details

  #### Returns DefaultHelpGenerator

## Properties

### Protected groupToOption

groupToOption: {}

Inherited from AbstractHelpGenerator.groupToOption

- Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:85

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

Inherited from AbstractHelpGenerator.mCommandDefinition

- Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:56

The command definition for which we are building help

### Protected mDefinitionTree

mDefinitionTree: ICommandDefinition

Inherited from AbstractHelpGenerator.mDefinitionTree

- Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:60

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

### Protected mExperimentalCommandDescription

mExperimentalCommandDescription: string = Constants.DEFAULT_EXPERIMENTAL_COMMAND_EXPLANATION

Inherited from AbstractHelpGenerator.mExperimentalCommandDescription

- Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:80

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

### Protected mLog

mLog: Logger

Inherited from AbstractHelpGenerator.mLog

- Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:70

Logger

### Protected mPrimaryHighlightColor

mPrimaryHighlightColor: string

Inherited from AbstractHelpGenerator.mPrimaryHighlightColor

- Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:72

### Protected mProduceMarkdown

mProduceMarkdown: boolean = false

Inherited from AbstractHelpGenerator.mProduceMarkdown

- Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:65

Produce markdown - not help text.

### Protected mRootCommandName

mRootCommandName: string

Inherited from AbstractHelpGenerator.mRootCommandName

- Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:51

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

### Protected optionToDescription

optionToDescription: {}

Inherited from AbstractHelpGenerator.optionToDescription

- Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:92

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

- Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:55

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:"

- Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:48

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

static
memberof

  DefaultHelpGenerator

### Static Readonly HELP_INDENT

HELP_INDENT: " " = " "

- Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:39

The help indent for spacing/alignment

static
memberof

  DefaultHelpGenerator

### Static LONG_DASH

LONG_DASH: string = "--"

Inherited from AbstractHelpGenerator.LONG_DASH

- Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:26

### Static SHORT_DASH

SHORT_DASH: string = "-"

Inherited from AbstractHelpGenerator.SHORT_DASH

- Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:25

## Accessors

### Protected log

- get log(): Logger

- Inherited from AbstractHelpGenerator.log

  - Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:99

  Get log instance

  #### Returns Logger

## Methods

### buildChildrenSummaryTables

- buildChildrenSummaryTables(): string

- - Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:202

  Builds a table of commands/groups for display in the help:

  ## GROUPS

  group1 hello this is group1 group2 hello this is group2

  #### Returns string

  : Returns the table for display.

### buildCommandAndAliases

- buildCommandAndAliases(commandDefinition: ICommandDefinition): string

- - Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:181

  Build a string containing the command name and aliases separated by the vertical bar: command | c

  memberof

    DefaultHelpGenerator

  #### Parameters

  - ##### commandDefinition: ICommandDefinition

    The definition for the command

  #### Returns string

  - Contains the command name followed by the aliases (e.g. command | c)

### buildCommandOptionsSection

- buildCommandOptionsSection(): string

- - Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:422

  From the map of options (group to option), formulate the group and options in the form of:

  ## OPTION GROUP

  option1

       Description of option1

  option2

       Description of option2

  #### Returns string

### buildDescriptionSection

- buildDescriptionSection(): string

- - Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:354

  Build the command description section of the help text:

  ## DESCRIPTION

  This command is great.

  memberof

    DefaultHelpGenerator

  #### Returns string

  - The command description text

### buildExamplesSection

- buildExamplesSection(): string

- - Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:494

  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

- Overrides AbstractHelpGenerator.buildFullCommandHelpText

  - Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:130

  Returns the help text for the command definition - the help text contains the standard items such as description/usage/etc. and also contains the full option descriptions for the command.

  #### Parameters

  - ##### Default value includeGlobalOptions: boolean = true

  #### Returns string

  - The help text for --help or markdown.

### buildFullGroupHelpText

- buildFullGroupHelpText(): string

- - Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:98

  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

- - Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:334

  Build the global options section of the command help text.

  ## GLOBAL OPTIONS

  ...

  memberof

    DefaultHelpGenerator

  #### Returns string

  - The global options help text section

### buildHeader

- buildHeader(header: string): string

- - Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:481

  Produces a header for the current section in help:

  ## COMMANDS

  memberof

    DefaultHelpGenerator

  #### Parameters

  - ##### header: string

    the header text (e.g. COMMANDS)

  #### Returns string

  - The header

### buildHelp

- buildHelp(): string

- Implementation of IHelpGenerator.buildHelp

  Overrides AbstractHelpGenerator.buildHelp

  - Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:74

  Construct the full help text for display.

  memberof

    DefaultHelpGenerator

  #### Returns string

  - The full help text

### Protected buildOptionMaps

- buildOptionMaps(): void

- Inherited from AbstractHelpGenerator.buildOptionMaps

  - Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:159

  #### Returns void

### buildOptionText

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

- - Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:448

  Build the text for option:

  --option

  The description for this option

  #### Parameters

  - ##### optionString: string

    The option string (-- form or positional, etc.)

  - ##### description: string

    The description for the option

  #### Returns string

  - The option text

### buildPositionalArgumentsSection

- buildPositionalArgumentsSection(): string

- - Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:383

  Return the help text format for positional parameters - includes the parameter itself, the optional regex, and the full description.

  memberof

    DefaultHelpGenerator

  #### Returns string

  - The help text for each positional parameter.

### buildUsageDiagram

- buildUsageDiagram(): string

- - Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:266

  Build the usage diagram for the command. TODO - very simple at the moment, should be enhanced with a "better" diagram

  memberof

    DefaultHelpGenerator

  #### Returns string

### buildUsageSection

- buildUsageSection(): string

- - Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:319

  Build the usage section of the help text:

  ## USAGE

  command blah [options]

  memberof

    DefaultHelpGenerator

  #### Returns string

  - The usage help text section

### Protected dimGrey

- dimGrey(text: string): any

- Inherited from AbstractHelpGenerator.dimGrey

  - Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:261

  Highlight text in dim grey (disabled if producing markdown)

  #### Parameters

  - ##### text: string

    the text you would like to highlight

  #### Returns any

  the highlighted text

### Private escapeMarkdown

- escapeMarkdown(text: string): string

- - Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:555

  Utility function to escape Markdown special characters. Note: This should only be called once to avoid double escaping.

  #### Parameters

  - ##### text: string

    The text to escape

  #### Returns string

  - The escaped string

### Protected explainType

- explainType(type: CommandOptionType): string

- Inherited from AbstractHelpGenerator.explainType

  - Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:246

  #### Parameters

  - ##### type: CommandOptionType

  #### Returns string

### Protected getCaseSensitiveFlagByOptionName

- getCaseSensitiveFlagByOptionName(optionName: string): boolean

- Inherited from AbstractHelpGenerator.getCaseSensitiveFlagByOptionName

  - Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:190

  #### Parameters

  - ##### optionName: string

  #### Returns boolean

### getExperimentalCommandSection

- getExperimentalCommandSection(): string

- - Defined in @zowe/imperative/src/cmd/src/help/DefaultHelpGenerator.ts:533

  Get a blurb explaining experimental commands if this command is experimental

  memberof

    DefaultHelpGenerator

  #### Returns string

  - If this command is experimental, returns the experimental command explanation block

### getOptionAndAliasesString

- getOptionAndAliasesString(option: ICommandOptionDefinition, caseSensitive?: boolean): string

- Inherited from AbstractHelpGenerator.getOptionAndAliasesString

  - Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:125

  #### Parameters

  - ##### option: ICommandOptionDefinition

  - ##### Optional caseSensitive: boolean

  #### Returns string

### Protected grey

- grey(text: string): any

- Inherited from AbstractHelpGenerator.grey

  - Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:273

  Highlight text in grey (disabled if producing markdown)

  #### Parameters

  - ##### text: string

    the text you would like to highlight

  #### Returns any

  the highlighted text

### Protected renderHelp

- renderHelp(help: string): string

- Inherited from AbstractHelpGenerator.renderHelp

  - Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:203

  #### Parameters

  - ##### help: string

  #### Returns string

### Static formatHelpHeader

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

- Inherited from AbstractHelpGenerator.formatHelpHeader

  - Defined in @zowe/imperative/src/cmd/src/help/abstract/AbstractHelpGenerator.ts:35

  Get a heading for the CLI / help

  #### Parameters

  - ##### header: string

    The text you want to display in the header

  - ##### Default value indent: string = " "

    prefix the the heading and dashes with this string (defaults to one space)

  - ##### color: string

    the color to highlight the header in

  #### Returns string

  the formatted/colored header

Generated using TypeDoc