Skip to main content

render_subcommand_list

Function render_subcommand_list 

Source
pub fn render_subcommand_list(commands: &[Command]) -> String
Expand description

Render a compact listing of multiple commands (e.g. for a top-level help).

Each line has the format canonical summary. This is suitable for displaying all registered commands when no specific command is requested.

§Arguments

  • commands — The commands to list.

§Examples

let cmds = vec![
    Command::builder("list").summary("List items").build().unwrap(),
    Command::builder("get").summary("Get an item").build().unwrap(),
];

let listing = render_subcommand_list(&cmds);
assert!(listing.contains("list"));
assert!(listing.contains("List items"));