aboutsummaryrefslogtreecommitdiffstats
path: root/fatcat-cli/src
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-02-10 11:00:48 -0800
committerBryan Newbold <bnewbold@archive.org>2021-02-10 11:00:48 -0800
commitd4d8caf98bd3595f182d014e4606bbb79dafee05 (patch)
treeb464947500471413aba22d7415cf2b32912ae46a /fatcat-cli/src
parentefdc17248cbf8336f28c377a301752604fb6db74 (diff)
downloadfatcat-cli-d4d8caf98bd3595f182d014e4606bbb79dafee05.tar.gz
fatcat-cli-d4d8caf98bd3595f182d014e4606bbb79dafee05.zip
shell completions (via hidden flag)
Diffstat (limited to 'fatcat-cli/src')
-rw-r--r--fatcat-cli/src/main.rs15
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>() {