1use clap::{Command, FromArgMatches as _, Parser, Subcommand as _};
2
3#[derive(Parser, Debug)]
4enum Subcommands {
5 Derived {
6 #[arg(short, long)]
7 derived_flag: bool,
8 },
9}
10
11fn main() {
12 let cli = Command::new("Built CLI");
13 // Augment with derived subcommands
14 let cli = Subcommands::augment_subcommands(cli);
15
16 let matches = cli.get_matches();
17 let derived_subcommands = Subcommands::from_arg_matches(&matches)
18 .map_err(|err| err.exit())
19 .unwrap();
20 println!("Derived subcommands: {derived_subcommands:#?}");
21}
22