2022-08-15 19:29:46 +00:00
|
|
|
fn command() -> clap::Command {
|
2024-08-29 02:02:32 +00:00
|
|
|
clap::Command::new("dynamic")
|
2022-04-15 21:08:11 +00:00
|
|
|
.arg(
|
|
|
|
clap::Arg::new("input")
|
2022-09-02 18:11:11 +00:00
|
|
|
.long("input")
|
2022-04-15 21:08:11 +00:00
|
|
|
.short('i')
|
|
|
|
.value_hint(clap::ValueHint::FilePath),
|
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
clap::Arg::new("format")
|
2022-09-02 18:11:11 +00:00
|
|
|
.long("format")
|
2022-04-15 21:08:11 +00:00
|
|
|
.short('F')
|
2022-05-24 01:16:02 +00:00
|
|
|
.value_parser(["json", "yaml", "toml"]),
|
2022-04-15 21:08:11 +00:00
|
|
|
)
|
2024-08-29 02:02:32 +00:00
|
|
|
.args_conflicts_with_subcommands(true)
|
2022-04-15 21:08:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2024-08-16 15:35:07 +00:00
|
|
|
clap_complete::CompleteEnv::with_factory(command).complete();
|
2024-08-12 15:53:24 +00:00
|
|
|
|
2022-04-15 21:08:11 +00:00
|
|
|
let cmd = command();
|
|
|
|
let matches = cmd.get_matches();
|
2024-08-29 02:02:32 +00:00
|
|
|
println!("{matches:#?}");
|
2022-04-15 21:08:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn verify_cli() {
|
2022-09-02 18:11:11 +00:00
|
|
|
command().debug_assert();
|
2022-04-15 21:08:11 +00:00
|
|
|
}
|