Skip to main content

render_usage

Function render_usage 

Source
pub fn render_usage(node: &Node, path: &[&str]) -> String
Expand description

Render a --help-style usage block for a node at the given path (TODO item 6). The same model that drives tab completion drives help, so the two surfaces can’t drift.

Output format:

USAGE: <path>

<help text>

FLAGS:
  --foo    Help text for --foo
  --bar    (no help)

SUBCOMMANDS:
  sub-a    Help text for sub-a
  sub-b    Help text for sub-b

Sections are omitted when their content is empty. Children are listed in BTreeMap order (alphabetical).