-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example for multicall completion generation
- Loading branch information
1 parent
2fe7a89
commit 5ec71cc
Showing
2 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use clap::{App, AppSettings}; | ||
use clap_generate::{generate, generators::Bash}; | ||
use std::io; | ||
|
||
fn main() { | ||
let mut app = App::new(env!("CARGO_CRATE_NAME")) | ||
.setting(AppSettings::Multicall) | ||
.subcommand( | ||
App::new("test") | ||
.subcommand(App::new("config")) | ||
.subcommand(App::new("generate-completions")), | ||
) | ||
.subcommand(App::new("hello")); | ||
for applet in app.get_subcommands_mut() { | ||
let name = applet.get_name().to_owned(); | ||
generate(Bash, applet, &name, &mut io::stdout()); | ||
} | ||
} |