Skip to main content

Class: HelpGenerator

help.HelpGenerator

Constructors

constructor

new HelpGenerator(entry, config?): HelpGenerator

Parameters

NameTypeDescription
entryMassargCommand<any>-
config?Object-
config.lineLength?numberMaximum length of a row in the help output
config.descriptionStyle?ObjectStyle of the help description
config.descriptionStyle.bold?boolean-
config.descriptionStyle.underline?boolean-
config.descriptionStyle.color?"red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite"-
config.descriptionStyle.reset?boolean-
config.bindCommand?booleanWhether to bind the help command to this command Set this to true to automatically add a help command to this command's subcommands.
config.bindOption?booleanWhether to bind the help option to this command Set this to true to automatically add a --help option to this command's options.
config.useGlobalTableColumns?booleanWhether to align all tables to the column widths, or have each table be independent. Default is true
config.commandOptions?ObjectOptions for generating the table of commands
config.commandOptions.compact?booleanWhen false, each row is separated by a blank line
config.commandOptions.nameStyle?ObjectStyle of the command/option name
config.commandOptions.nameStyle.bold?boolean-
config.commandOptions.nameStyle.underline?boolean-
config.commandOptions.nameStyle.color?"red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite"-
config.commandOptions.nameStyle.reset?boolean-
config.commandOptions.descriptionStyle?ObjectStyle of the command/option description
config.commandOptions.descriptionStyle.bold?boolean-
config.commandOptions.descriptionStyle.underline?boolean-
config.commandOptions.descriptionStyle.color?"red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite"-
config.commandOptions.descriptionStyle.reset?boolean-
config.commandOptions.namePrefix?stringPrefix for the command/option name (default is the command's prefix)
config.commandOptions.aliasPrefix?stringPrefix for the command/option aliases (default is the command's prefix)
config.optionOptions?ObjectOptions for generating the table of options
config.optionOptions.compactundefined | boolean-
config.optionOptions.nameStyleundefined | { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean }-
config.optionOptions.descriptionStyleundefined | { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean }-
config.optionOptions.namePrefixundefined | string-
config.optionOptions.aliasPrefixundefined | string-
config.optionOptions.displayNegationsundefined | boolean-
config.optionOptions.displayDefaultValueundefined | boolean-
config.optionOptions.defaultValueStyleundefined | { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean }-
config.titleStyle?ObjectStyle of the help title
config.titleStyle.bold?boolean-
config.titleStyle.underline?boolean-
config.titleStyle.color?"red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite"-
config.titleStyle.reset?boolean-
config.subtitleStyle?ObjectStyle of the help subtitles for commands, options and examples
config.subtitleStyle.bold?boolean-
config.subtitleStyle.underline?boolean-
config.subtitleStyle.color?"red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite"-
config.subtitleStyle.reset?boolean-
config.usageStyle?ObjectStyle of the help usage
config.usageStyle.options?ObjectStyle of the help usage options (if any)
config.usageStyle.options.bold?boolean-
config.usageStyle.options.underline?boolean-
config.usageStyle.options.color?"red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite"-
config.usageStyle.options.reset?boolean-
config.usageStyle.prefix?ObjectStyle of the help usage title - appears before the usage text (custom or auto)
config.usageStyle.prefix.bold?boolean-
config.usageStyle.prefix.underline?boolean-
config.usageStyle.prefix.color?"red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite"-
config.usageStyle.prefix.reset?boolean-
config.usageStyle.main?ObjectFor custom usage text, this is the primary style used (right after the prefix style). For automated usage text, this style is used for the command/binary name
config.usageStyle.main.bold?boolean-
config.usageStyle.main.underline?boolean-
config.usageStyle.main.color?"red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite"-
config.usageStyle.main.reset?boolean-
config.usageStyle.command?ObjectStyle of the help usage commands (if any)
config.usageStyle.command.bold?boolean-
config.usageStyle.command.underline?boolean-
config.usageStyle.command.color?"red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite"-
config.usageStyle.command.reset?boolean-
config.headerStyle?ObjectStyle of the help header
config.headerStyle.bold?boolean-
config.headerStyle.underline?boolean-
config.headerStyle.color?"red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite"-
config.headerStyle.reset?boolean-
config.footerStyle?ObjectStyle of the help footer
config.footerStyle.bold?boolean-
config.footerStyle.underline?boolean-
config.footerStyle.color?"red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite"-
config.footerStyle.reset?boolean-
config.exampleOptions?ObjectOptions for examples section
config.exampleOptions.compact?booleanWhether to compact the examples section
config.exampleOptions.descriptionStyle?ObjectStyle of the example description
config.exampleOptions.descriptionStyle.bold?boolean-
config.exampleOptions.descriptionStyle.underline?boolean-
config.exampleOptions.descriptionStyle.color?"red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite"-
config.exampleOptions.descriptionStyle.reset?boolean-
config.exampleOptions.inputStyle?ObjectStyle of the example input
config.exampleOptions.inputStyle.bold?boolean-
config.exampleOptions.inputStyle.underline?boolean-
config.exampleOptions.inputStyle.color?"red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite"-
config.exampleOptions.inputStyle.reset?boolean-
config.exampleOptions.outputStyle?ObjectStyle of the example output
config.exampleOptions.outputStyle.bold?boolean-
config.exampleOptions.outputStyle.underline?boolean-
config.exampleOptions.outputStyle.color?"red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite"-
config.exampleOptions.outputStyle.reset?boolean-
config.exampleOptions.inputPrefix?stringPrefix for the example input (default: $)
config.exampleOptions.outputPrefix?stringPrefix for the example output (default: >)
config.exampleOptions.prefixStyle?ObjectStyle of the example input/output prefixes
config.exampleOptions.prefixStyle.bold?boolean-
config.exampleOptions.prefixStyle.underline?boolean-
config.exampleOptions.prefixStyle.color?"red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite"-
config.exampleOptions.prefixStyle.reset?boolean-
config.usageText?stringText to display at the very top, describing CLI usage
config.headerText?stringText to display above the description, below the usage
config.footerText?stringText to display at the very bottom, below the examples

Returns

HelpGenerator

Defined in

src/help.ts:208

Properties

entry

entry: MassargCommand<any>

Defined in

src/help.ts:205


config

config: DeepRequired<{ lineLength?: number ; descriptionStyle?: { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean } ; bindCommand?: boolean ; bindOption?: boolean ; useGlobalTableColumns?: boolean ; commandOptions?: { compact?: boolean ; nameStyle?: { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean } ; descriptionStyle?: { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean } ; namePrefix?: string ; aliasPrefix?: string } ; optionOptions?: { compact: undefined | boolean ; nameStyle: undefined | { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean } ; descriptionStyle: undefined | { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean } ; namePrefix: undefined | string ; aliasPrefix: undefined | string ; displayNegations: undefined | boolean ; displayDefaultValue: undefined | boolean ; defaultValueStyle: undefined | { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean } } ; titleStyle?: { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean } ; subtitleStyle?: { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean } ; usageStyle?: { options?: { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean } ; prefix?: { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean } ; main?: { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean } ; command?: { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean } } ; headerStyle?: { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean } ; footerStyle?: { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean } ; exampleOptions?: { compact?: boolean ; descriptionStyle?: { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean } ; inputStyle?: { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean } ; outputStyle?: { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean } ; inputPrefix?: string ; outputPrefix?: string ; prefixStyle?: { bold?: boolean ; underline?: boolean ; color?: "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "gray" | "grey" | "brightRed" | "brightGreen" | "brightYellow" | "brightBlue" | "brightMagenta" | "brightCyan" | "brightWhite" ; reset?: boolean } } ; usageText?: string ; headerText?: string ; footerText?: string }>

Defined in

src/help.ts:206

Methods

generate

generate(): string

Returns

string

Defined in

src/help.ts:213


printHelp

printHelp(): void

Returns

void

Defined in

src/help.ts:332