Skip to main content

runnable_commands

Function runnable_commands 

Source
pub fn runnable_commands(tree: &CommandDoc) -> Vec<String>
Expand description

Every command a person can run, as they type it after majordomus.

A command that only groups others is not one: it runs nothing, so there is no operation for it to be or to be missing. That is read from clap’s own declaration — a command that grows a required subcommand stops being runnable on the same edit — and never from a list.

use majordomus_cli::{cli, quality::parity};
let commands = parity::runnable_commands(&cli::tree());
assert!(commands.iter().any(|c| c == "capabilities list"));
assert!(commands.iter().all(|c| !c.starts_with("majordomus")), "the executable's own name is not part of a command");