assert_sorted

Function assert_sorted 

Source
pub fn assert_sorted(cmd: &Command)
Expand description

Validates that subcommands are sorted alphabetically.

This function takes a clap Command and checks that all its subcommands are sorted alphabetically by name.

ยงExample

use clap::{Command, Subcommand};

#[derive(Subcommand)]
enum Commands {
    Add,
    Delete,
    List,
}

let cmd = clap::Command::new("mycli");
// Add subcommands to cmd...
clap_sort::assert_sorted(&cmd);