1use std::fmt::Display;
2
3use clap::{Parser, Subcommand};
4use clap_verbosity_flag::Verbosity;
5
6mod alpha;
7mod anagram;
8mod boxed;
9mod list;
10mod words;
11
12#[derive(Parser, Debug)]
13#[clap(author, version, about, long_about = None)]
14pub struct Cli {
15 #[clap(flatten)]
17 pub logging: Verbosity,
18 #[command(subcommand)]
20 pub cmd: Commands,
21}
22
23#[derive(Debug, Subcommand, Clone)]
24pub enum Commands {
25 Alpha(alpha::Cmd),
27 List(list::Cmd),
29 Anagram(anagram::Cmd),
31 Boxed(boxed::Cmd),
33 Words(words::Cmd),
35}
36
37impl Display for Commands {
38 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
39 match self {
40 Commands::Alpha(_) => write!(f, "alpha"),
41 Commands::List(_) => write!(f, "list"),
42 Commands::Anagram(_) => write!(f, "anagram"),
43 Commands::Boxed(_) => write!(f, "boxed"),
44 Commands::Words(_) => write!(f, "words"),
45 }
46 }
47}