Documentation
¶
Overview ¶
Package cobrahelp renders every help screen of a cobra command tree: what the command is, then every leaf beneath it, spelled from the screen's own command down to the leaf with its arguments, then its examples and flags. A command with children gets no row, even one that runs.
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 leaf 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 row's first word is always one of that command's children.
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: every command tree in the process loses alphabetical sorting, not only root's.
Types ¶
This section is empty.