2022-02-12 03:48:29 +00:00
|
|
|
use clap::{Arg, Command};
|
2021-12-31 17:59:15 +00:00
|
|
|
use clap_complete::generate;
|
|
|
|
use clap_complete_fig::Fig;
|
2021-10-08 00:54:14 +00:00
|
|
|
use std::io;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn generate_completions() {
|
2022-02-14 21:47:20 +00:00
|
|
|
let mut cmd = Command::new("test_app")
|
2021-10-12 18:59:56 +00:00
|
|
|
.arg(Arg::new("config").short('c').global(true))
|
|
|
|
.arg(Arg::new("v").short('v').conflicts_with("config"))
|
2021-10-08 00:54:14 +00:00
|
|
|
.subcommand(
|
2022-02-12 03:48:29 +00:00
|
|
|
Command::new("test")
|
2021-10-08 00:54:14 +00:00
|
|
|
.about("Subcommand")
|
|
|
|
.arg(Arg::new("debug").short('d')),
|
|
|
|
);
|
|
|
|
|
2022-02-14 21:47:20 +00:00
|
|
|
generate(Fig, &mut cmd, "test_app", &mut io::sink());
|
2021-10-08 00:54:14 +00:00
|
|
|
}
|