pub fn is_sorted(cmd: &Command) -> Result<(), String>Expand description
Checks if subcommands and arguments are sorted, returning a Result instead of panicking.
This checks:
- Subcommands are sorted alphabetically
- Arguments are grouped and sorted by type
Recursively validates all subcommands.
ยงExample
use clap::Command;
let cmd = Command::new("mycli");
match clap_sort::is_sorted(&cmd) {
Ok(()) => println!("Everything is sorted!"),
Err(msg) => eprintln!("Error: {}", msg),
}