rhythmjs

Search documentation

Search guides, the tutorial and every package.

On this page

Every piece is its own subpath export; there is no root barrel.

Documentation middleware#

commandHelp(options)#
From @rhythmjs/climax/help/command. A middleware that only carries documentation. Options: summary, description, examples (printed as $ … lines), deprecated (true or a message) and hidden. Place it before the command's handler. Several handlers' fields are merged left to right.
optionHelp(options)#
From @rhythmjs/climax/help/option. Documents one flag: name, alias, description, type (the value placeholder), required and default. As a command handler it applies to that command; through cli.use() it applies to the commands registered after it, including mounted clis.

The help module#

helpModule.forRoot(options?)#
From @rhythmjs/climax/help/module. Returns a Rhythm module that answers help for the app it is registered in. Register it before the cli.
name / description#
The program name used in Usage: lines, and a line printed above the command index.
command#
The word that triggers help as a command. Defaults to "help". Pass false to keep only --help and -h, for example when you have a help command of your own.
includeUndocumented / includeHidden#
includeUndocumented (default true) lists commands without any help metadata; includeHidden (default false) lists commands marked hidden.
ctx.helpService#
Provided by the module. commands() returns the structured CommandDoc[], cached after the first call. render(topic?) returns the output lines for a topic given as an array of words.

Generator and renderer#

generate(clis, options?)#
From @rhythmjs/climax/help/generate. Walks one or more clis (anything with entries) in registration order, recurses into mounted clis, and returns CommandDoc[]. Takes includeUndocumented and includeHidden.
CommandDoc#
segments, usage (for example deploy <environment>; optional tokens render as [name] and ** as [args...]), the command fields, and options, which has inherited options first.
render(docs, topic, options?)#
From @rhythmjs/climax/help/render. Returns lines for a topic. resolve(docs, topic) tells whether it is an index, a command, a group or unknown. renderIndex, renderGroup and renderCommand are the individual pieces. Options: name, description.
metadata#
@rhythmjs/climax/help/metadata exports fragmentOf, withFragment and docOnly, for building your own documentation middleware on the same mechanism.

Subpath exports: ./help/command, ./help/option, ./help/module, ./help/generate, ./help/render and ./help/metadata. Walk-through in command help and options and nesting.