Documentation
¶
Overview ¶
Package cobrahelp renders every help screen of a cobra command tree in the help grammar: what the command is, then every command a caller can run beneath it, spelled from the screen's own command down to the leaf with its arguments, then its examples and flags.
Cobra's own screen names only the next word down, so a command three levels down is three screens away, each ending in `[command]`. Listing the leaves of the whole subtree puts every command on the root and each namespace's share of them on that namespace. A row starts at the word after the screen's own command, as cobra's rows do, so a reader of help screens that matches a row's first word against the command's children still finds them.
The renderer replaces cobra's help and usage templates rather than swapping their command rows. Cobra's template gives a namespace a `Usage: <cmd> [command]` block, which a first-time user reads as the answer, and puts the examples above the commands. This screen has no such block and lists the commands first.
Everything a screen shows comes from the tree. A section is a group the command declares with AddGroup, in the order it adds them, and a command sits in the order the tree adds it. Commands no group claims follow under "Other commands".
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Install ¶
Install renders every screen in root's tree, help and usage alike.
Every list prints in the order the tree adds it, which is the order a command is reached for, so Install turns off cobra's alphabetical sorting. That setting is cobra's and process-wide, which is why one call in the file building the root is the whole installation.
Types ¶
This section is empty.