mirror of
https://github.com/clap-rs/clap
synced 2025-03-05 07:47:40 +00:00
In a follow up commit, my editor stripped trailing whitespace. Rather than have everyone fight this, let's not make a deal over the small stuff.
26 lines
802 B
Rust
26 lines
802 B
Rust
use clap::{App, Arg};
|
|
use clap_generate::{generate, generators::*};
|
|
use std::io;
|
|
|
|
#[test]
|
|
fn generate_completions() {
|
|
let mut app = App::new("test_app")
|
|
.arg(
|
|
Arg::new("config")
|
|
.short('c')
|
|
.conflicts_with("v")
|
|
.global(true),
|
|
)
|
|
.arg(Arg::new("v").short('v'))
|
|
.subcommand(
|
|
App::new("test")
|
|
.about("Subcommand")
|
|
.arg(Arg::new("debug").short('d')),
|
|
);
|
|
|
|
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());
|
|
}
|