1use clap::FromArgMatches;
2use clap::Subcommand;
3
4fn command() -> clap::Command {
5    let cmd = clap::Command::new("dynamic")
6        .arg(
7            clap::Arg::new("input")
8                .long("input")
9                .short('i')
10                .value_hint(clap::ValueHint::FilePath),
11        )
12        .arg(
13            clap::Arg::new("format")
14                .long("format")
15                .short('F')
16                .value_parser(["json", "yaml", "toml"]),
17        )
18        .args_conflicts_with_subcommands(true);
19    clap_complete::dynamic::bash::CompleteCommand::augment_subcommands(cmd)
20}
21
22fn main() {
23    let cmd = command();
24    let matches = cmd.get_matches();
25    if let Ok(completions) =
26        clap_complete::dynamic::bash::CompleteCommand::from_arg_matches(&matches)
27    {
28        completions.complete(&mut command());
29    } else {
30        println!("{:#?}", matches);
31    }
32}
33
34#[test]
35fn verify_cli() {
36    command().debug_assert();
37}
38