clap/clap_complete/examples/bash_completion.rs

12 lines
312 B
Bash
Raw Normal View History

2022-02-12 03:48:29 +00:00
use clap::Command;
2021-12-31 19:20:55 +00:00
use clap_complete::{generate, shells::Bash};
2020-02-06 10:19:03 +00:00
use std::io;
fn main() {
2022-02-14 21:47:20 +00:00
let mut cmd = Command::new("myapp")
2022-02-12 03:48:29 +00:00
.subcommand(Command::new("test").subcommand(Command::new("config")))
.subcommand(Command::new("hello"));
2020-02-06 10:19:03 +00:00
2022-02-14 21:47:20 +00:00
generate(Bash, &mut cmd, "myapp", &mut io::stdout());
2020-02-06 10:19:03 +00:00
}