Creates an instance of DefaultHelpGenerator.
Imperative config parameters for help generation - See interface for details
The command definitions for generating help - See interface for details
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"]
The command definition for which we are building help
The full command definition - which includes the parents of the command.
The configured experimental command description. Has a default, generic description which can be overridden through parameters to the constructor
Logger
Produce markdown - not help text.
The command name being invoked by the user. For example, when using "banana --help", banana is the command name.
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"
Indicates that the help generator should skip introducing breaks based on terminal width
Standard imperative error message tag for errors thrown by the help generator
The help indent for spacing/alignment
Get log instance
Builds a table of commands/groups for display in the help:
group1 hello this is group1 group2 hello this is group2
: Returns the table for display.
Build a string containing the command name and aliases separated by the vertical bar: command | c
The definition for the command
From the map of options (group to option), formulate the group and options in the form of:
option1
Description of option1
option2
Description of option2
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
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.
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.
Produces a header for the current section in help:
the header text (e.g. COMMANDS)
Construct the full help text for display.
Build the text for option:
--option
The description for this option
The option string (-- form or positional, etc.)
The description for the option
Return the help text format for positional parameters - includes the parameter itself, the optional regex, and the full description.
Build the usage diagram for the command. TODO - very simple at the moment, should be enhanced with a "better" diagram
Highlight text in dim grey (disabled if producing markdown)
the text you would like to highlight
the highlighted text
Utility function to escape Markdown special characters. Note: This should only be called once to avoid double escaping.
The text to escape
Get a blurb explaining experimental commands if this command is experimental
Highlight text in grey (disabled if producing markdown)
the text you would like to highlight
the highlighted text
Get a heading for the CLI / help
The text you want to display in the header
prefix the the heading and dashes with this string (defaults to one space)
the color to highlight the header in
the formatted/colored header
Generated using TypeDoc
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