Class: MassargHelpCommand<T>
command.MassargHelpCommand
A command that prints help for this command, or a sub-command if specified.
This command is automatically added to the top-level command if you use bindCommand: true in help().
You can also add it manually to any command.
Type parameters
| Name | Type |
|---|---|
T | extends Object = { command?: string } |
Hierarchy
-
↳
MassargHelpCommand
Constructors
constructor
• new MassargHelpCommand<T>(config?): MassargHelpCommand<T>
Type parameters
| Name | Type |
|---|---|
T | extends Object = { command?: string } |
Parameters
| Name | Type |
|---|---|
config | Partial<Omit<{ name: string ; description: string ; run: Runner<T> ; aliases?: string[] ; aliasPrefix?: string ; optionPrefix?: string }, "run">> |
Returns
Overrides
Defined in
Properties
name
• name: string
Inherited from
Defined in
description
• description: string
Inherited from
Defined in
aliases
• aliases: string[]
Inherited from
Defined in
commands
• commands: MassargCommand<any>[] = []
Inherited from
Defined in
options
• options: MassargOption<unknown, ArgsObject>[] = []
Inherited from
Defined in
examples
• examples: MassargExample[] = []
Inherited from
Defined in
args
• args: Partial<T> = {}
Inherited from
Defined in
parent
• Optional parent: MassargCommand<any>
Inherited from
Defined in
optionPrefix
• optionPrefix: string = DEFAULT_OPT_FULL_PREFIX
Inherited from
Defined in
aliasPrefix
• aliasPrefix: string = DEFAULT_OPT_SHORT_PREFIX
Inherited from
Defined in
Accessors
optionPrefixes
• get optionPrefixes(): Prefixes
Returns
Inherited from
MassargCommand.optionPrefixes
Defined in
helpConfig
• get helpConfig(): 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 }>
Returns
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 }>
Inherited from
MassargCommand.helpConfig
Defined in
Methods
command
▸ command<A>(config): MassargCommand<T & A>
Add a sub-command to this command.
The sub-command will inherit all help configuration from the parent commands, all the way up to the top-level command.
While options are not inherited, they will be passed from any parent commands to the sub-command when invoked.
Type parameters
| Name | Type |
|---|---|
A | extends ArgsObject = T |
Parameters
| Name | Type | Description |
|---|---|---|
config | Object | - |
config.name | string | Command name |
config.description | string | Command description, displayed in the help output |
config.run | Runner<A> | Function used when invoking this command. It receives the parsed options and the primary instance of Massarg used to invoke this command (the top-level instance) |
config.aliases? | string[] | Command aliases |
config.aliasPrefix? | string | The prefix to match before option aliases, e.g. - |
config.optionPrefix? | string | The prefix to match before option names, e.g. -- |
Returns
MassargCommand<T & A>
Inherited from
Defined in
▸ command<A>(config): MassargCommand<T & A>
Type parameters
| Name | Type |
|---|---|
A | extends ArgsObject = T |
Parameters
| Name | Type |
|---|---|
config | MassargCommand<A> |
Returns
MassargCommand<T & A>
Inherited from
Defined in
flag
▸ flag(config): MassargCommand<T>
Adds a flag to this command.
A flag is an option that is either present or not. It can be used to toggle a boolean value, or to indicate that a command should be run in a different mode.
A flag can be negated by using negatable: true. By default, the negated name is the same
as the option name, prefixed by no-, and each of the aliases will be uppercased.
For example, --verbose and --no-verbose, or -v and -V.
This behavior can be overridden by the negatedName and negatedAliases options.
Parameters
| Name | Type |
|---|---|
config | Object |
config.name | string |
config.description | string |
config.aliases | string[] |
config.defaultValue | any |
config.array | undefined | boolean |
config.required | undefined | boolean |
config.hidden | undefined | boolean |
config.outputName | undefined | string |
config.negatable | undefined | boolean |
config.negationName | undefined | string |
config.negationAliases | undefined | string[] |
Returns
Inherited from
Defined in
▸ flag(config): MassargCommand<T>
Parameters
| Name | Type |
|---|---|
config | MassargFlag |
Returns
Inherited from
Defined in
option
▸ option<T, A>(config): MassargCommand<T>
Adds an option to this command.
An option is a named value that can be passed to a command. It can be required or optional, and can be of any type.
You can specify a default value for an option, which will be used if the option is not passed to the command.
You can also specify a parse function, which will be used to parse the value passed to the command. This is useful if you want to parse a string into a more complex type, or if you want to validate the value.
Type parameters
| Name | Type |
|---|---|
T | string |
A | extends ArgsObject = T |
Parameters
| Name | Type |
|---|---|
config | MassargOption<T, A> |
Returns
Inherited from
Defined in
▸ option<T, A>(config): MassargCommand<T>
Type parameters
| Name | Type |
|---|---|
T | string |
A | extends ArgsObject = T |
Parameters
| Name | Type |
|---|---|
config | Object |
config.name | string |
config.description | string |
config.aliases | string[] |
config.type | undefined | "number" |
config.defaultValue | any |
config.array | undefined | boolean |
config.required | undefined | boolean |
config.isDefault | undefined | boolean |
config.hidden | undefined | boolean |
config.outputName | undefined | string |
config.parse | undefined | Parser<A, T> |
Returns
Inherited from
Defined in
example
▸ example(config): MassargCommand<T>
Adds an example to this command.
An example is a description of how to use the command, with an example input and output.
At least one of description, input or output must be provided, but neither alone is
required.
Parameters
| Name | Type | Description |
|---|---|---|
config | Object | - |
config.description? | string | Description of the example. This will appear as a title above the input/output line(s). |
config.input? | string | Input of the example. This will appear as a line below the description, with a $ prefix. The prefix can be changed using the help() function on the command. |
config.output? | string | Output of the example. This will appear as a line below the input, with a > prefix. The prefix can be changed using the help() function on the command. |
Returns
Inherited from
Defined in
help
▸ help(config): MassargCommand<T>
Configure the help output for this (and all child) commands.
You can automatically bind the help command to this command, and/or bind the help option to this command.
If you don't opt-in to this behavior with bindCommand or bindOption, you can still
access the help output via this.helpString() and this.printHelp().
Parameters
| Name | Type | Description |
|---|---|---|
config | Object | - |
config.lineLength? | number | Maximum length of a row in the help output |
config.descriptionStyle? | Object | Style 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? | boolean | Whether 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? | boolean | Whether 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? | boolean | Whether to align all tables to the column widths, or have each table be independent. Default is true |
config.commandOptions? | Object | Options for generating the table of commands |
config.commandOptions.compact? | boolean | When false, each row is separated by a blank line |
config.commandOptions.nameStyle? | Object | Style 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? | Object | Style 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? | string | Prefix for the command/option name (default is the command's prefix) |
config.commandOptions.aliasPrefix? | string | Prefix for the command/option aliases (default is the command's prefix) |
config.optionOptions? | Object | Options for generating the table of options |
config.optionOptions.compact | undefined | boolean | - |
config.optionOptions.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 } | - |
config.optionOptions.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 } | - |
config.optionOptions.namePrefix | undefined | string | - |
config.optionOptions.aliasPrefix | undefined | string | - |
config.optionOptions.displayNegations | undefined | boolean | - |
config.optionOptions.displayDefaultValue | undefined | boolean | - |
config.optionOptions.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 } | - |
config.titleStyle? | Object | Style 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? | Object | Style 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? | Object | Style of the help usage |
config.usageStyle.options? | Object | Style 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? | Object | Style 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? | Object | For 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? | Object | Style 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? | Object | Style 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? | Object | Style 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? | Object | Options for examples section |
config.exampleOptions.compact? | boolean | Whether to compact the examples section |
config.exampleOptions.descriptionStyle? | Object | Style 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? | Object | Style 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? | Object | Style 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? | string | Prefix for the example input (default: $) |
config.exampleOptions.outputPrefix? | string | Prefix for the example output (default: >) |
config.exampleOptions.prefixStyle? | Object | Style 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? | string | Text to display at the very top, describing CLI usage |
config.headerText? | string | Text to display above the description, below the usage |
config.footerText? | string | Text to display at the very bottom, below the examples |
Returns
Inherited from
Defined in
main
▸ main(run): MassargCommand<T>
Configure the main function for this command. This command will run when no sub-commands are provided.
If none is provided, help will be printed.
Parameters
| Name | Type |
|---|---|
run | Runner<T> |
Returns
Inherited from
Defined in
parse
▸ parse(argv?, args?, parent?): void | Promise<void>
Parse the given arguments and run the command or sub-commands along with the given options and flags.
To parse the arguments without running any commands and only get the output args,
use getArgs instead.
Parameters
| Name | Type |
|---|---|
argv | string[] |
args? | Partial<T> |
parent? | MassargCommand<T> |
Returns
void | Promise<void>
Inherited from
Defined in
getArgs
▸ getArgs(argv, __args?, parent?, parseCommands?): void | Promise<void>
Parse the given arguments and return the output args.
Parameters
| Name | Type |
|---|---|
argv | string[] |
__args? | Partial<T> |
parent? | MassargCommand<any> |
parseCommands? | false |
Returns
void | Promise<void>
Inherited from
Defined in
▸ getArgs(argv, __args?, parent?, parseCommands?): T
Parameters
| Name | Type |
|---|---|
argv | string[] |
__args? | Partial<T> |
parent? | MassargCommand<any> |
parseCommands? | true |
Returns
T
Inherited from
Defined in
helpString
▸ helpString(): string
Generate the help output for this command, and return it as a string.
Returns
string
Inherited from
Defined in
printHelp
▸ printHelp(): void
Print the help output for this command.
Returns
void