2020-10-30 20:23:35 +00:00
|
|
|
use std::io;
|
|
|
|
|
2021-12-31 19:20:55 +00:00
|
|
|
use clap::{App, Arg};
|
|
|
|
|
|
|
|
use clap_complete::{generate, shells::*};
|
|
|
|
|
2020-10-30 20:23:35 +00:00
|
|
|
#[test]
|
|
|
|
fn generate_completions() {
|
|
|
|
let mut app = App::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"))
|
2020-10-30 20:23:35 +00:00
|
|
|
.subcommand(
|
|
|
|
App::new("test")
|
|
|
|
.about("Subcommand")
|
|
|
|
.arg(Arg::new("debug").short('d')),
|
|
|
|
);
|
|
|
|
|
2021-08-18 18:25:43 +00:00
|
|
|
generate(Bash, &mut app, "test_app", &mut io::sink());
|
|
|
|
generate(Fish, &mut app, "test_app", &mut io::sink());
|
|
|
|
generate(PowerShell, &mut app, "test_app", &mut io::sink());
|
|
|
|
generate(Elvish, &mut app, "test_app", &mut io::sink());
|
|
|
|
generate(Zsh, &mut app, "test_app", &mut io::sink());
|
2020-10-30 20:23:35 +00:00
|
|
|
}
|