Debian Codegraph @

debian/rust-vendor/clap_complete/examples/dynamic.rs

raw
1 fn command() -> clap::Command {
2 clap::Command::new("dynamic")
3 .arg(
4 clap::Arg::new("input")
5 .long("input")
6 .short('i')
7 .value_hint(clap::ValueHint::FilePath),
8 )
9 .arg(
10 clap::Arg::new("format")
11 .long("format")
12 .short('F')
13 .value_parser(["json", "yaml", "toml"]),
14 )
15 .args_conflicts_with_subcommands(true)
16 }
17
18 fn main() {
19 clap_complete::CompleteEnv::with_factory(command).complete();
20
21 let cmd = command();
22 let matches = cmd.get_matches();
23 println!("{matches:#?}");
24 }
25
26 #[test]
27 fn verify_cli() {
28 command().debug_assert();
29 }