From 33368b57aa077ac13448f4d4927dd8a77934f763 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 11 Nov 2022 13:33:16 -0800 Subject: pds: manpage, shell completions --- adenosine-pds/src/bin/adenosine-pds.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'adenosine-pds') diff --git a/adenosine-pds/src/bin/adenosine-pds.rs b/adenosine-pds/src/bin/adenosine-pds.rs index b2044e1..d02b07c 100644 --- a/adenosine-pds/src/bin/adenosine-pds.rs +++ b/adenosine-pds/src/bin/adenosine-pds.rs @@ -37,6 +37,9 @@ struct Opt { #[structopt(global = true, long, short = "v", parse(from_occurrences))] verbose: i8, + #[structopt(long = "--shell-completions", hidden = true)] + shell_completions: Option, + #[structopt(subcommand)] cmd: Command, } @@ -128,6 +131,11 @@ fn main() -> Result<()> { dotenv::dotenv().ok(); let opt = Opt::from_args(); + if let Some(shell) = opt.shell_completions { + Opt::clap().gen_completions_to("adenosine", shell, &mut std::io::stdout()); + std::process::exit(0); + } + let log_level = match opt.verbose { std::i8::MIN..=-1 => "none", 0 => "warn", @@ -135,6 +143,7 @@ fn main() -> Result<()> { 2 => "debug", 3..=std::i8::MAX => "trace", }; + // hyper logging is very verbose, so crank that down even if everything else is more verbose let cli_filter = format!("{},hyper=error", log_level); // defer to env var config, fallback to CLI settings -- cgit v1.2.3