Climax@rhythmjs/climax
Climax API reference
Documentation middleware, the generator, the renderer and the help module of @rhythmjs/climax.
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(trueor a message) andhidden. 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),requiredanddefault. As a command handler it applies to that command; throughcli.use()it applies to the commands registered after it, including mounted clis.
The help module#
helpModule.forRoot(options?)#- From
@rhythmjs/climax/help/module. Returns aRhythmmodule 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". Passfalseto keep only--helpand-h, for example when you have ahelpcommand of your own. includeUndocumented / includeHidden#includeUndocumented(defaulttrue) lists commands without any help metadata;includeHidden(defaultfalse) lists commands markedhidden.ctx.helpService#- Provided by the module.
commands()returns the structuredCommandDoc[], 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 withentries) in registration order, recurses into mounted clis, and returnsCommandDoc[]. TakesincludeUndocumentedandincludeHidden. CommandDoc#segments,usage(for exampledeploy <environment>; optional tokens render as[name]and**as[args...]), the command fields, andoptions, 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,renderGroupandrenderCommandare the individual pieces. Options:name,description. metadata#@rhythmjs/climax/help/metadataexportsfragmentOf,withFragmentanddocOnly, 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.