diff options
author | Bryan Newbold <bnewbold@archive.org> | 2021-02-10 11:00:48 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2021-02-10 11:00:48 -0800 |
commit | d4d8caf98bd3595f182d014e4606bbb79dafee05 (patch) | |
tree | b464947500471413aba22d7415cf2b32912ae46a /fatcat-cli/src/main.rs | |
parent | efdc17248cbf8336f28c377a301752604fb6db74 (diff) | |
download | fatcat-cli-d4d8caf98bd3595f182d014e4606bbb79dafee05.tar.gz fatcat-cli-d4d8caf98bd3595f182d014e4606bbb79dafee05.zip |
shell completions (via hidden flag)
Diffstat (limited to 'fatcat-cli/src/main.rs')
-rw-r--r-- | fatcat-cli/src/main.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fatcat-cli/src/main.rs b/fatcat-cli/src/main.rs index 3b4a81b..6e3f2c7 100644 --- a/fatcat-cli/src/main.rs +++ b/fatcat-cli/src/main.rs @@ -44,6 +44,12 @@ struct Opt { #[structopt(global = true, long, short = "v", parse(from_occurrences))] verbose: i8, + #[structopt(long = "--shell-completions", hidden = true)] + shell_completions: Option<structopt::clap::Shell>, + + #[structopt(long = "--meow", hidden = true)] + meow: bool, + #[structopt(subcommand)] cmd: Command, } @@ -288,6 +294,15 @@ fn main() -> Result<()> { #[cfg(windows)] colored_json::enable_ansi_support(); + if let Some(shell) = opt.shell_completions { + Opt::clap().gen_completions_to("fatcat-cli", shell, &mut std::io::stdout()); + std::process::exit(0); + } + if opt.meow { + println!("meow meow"); + std::process::exit(0); + } + if let Err(err) = run(opt) { // Be graceful about some errors if let Some(io_err) = err.root_cause().downcast_ref::<std::io::Error>() { |