From c00107daa7f3b0a8ba10daa83e7a66e4c8f0d31a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 9 Jan 2023 18:56:47 +0000 Subject: [PATCH] Config inspection: Support --print-config in hippotat Signed-off-by: Ian Jackson --- client/client.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/client/client.rs b/client/client.rs index e382656..0f3cbbf 100644 --- a/client/client.rs +++ b/client/client.rs @@ -18,6 +18,12 @@ pub struct Opts { #[clap(flatten)] config: config::Opts, + + /// Print a config item, do not actually run + /// + /// One line is output for each association + #[clap(long)] + print_config: Option, } type OutstandingRequest<'r> = Pin( async fn main() { let opts = ::parse(); let (ics,) = config::startup("hippotat", LinkEnd::Client, - &opts.config, &opts.log, |ics|Ok((ics,))); + &opts.config, &opts.log, |ics| { + if let Some(arg) = &opts.print_config { + for ic in &ics { + ic.implement_print_config(arg)?; + } + process::exit(0); + } + + Ok((ics,)) + }); let https = HttpsConnector::new(); let hclient = hyper::Client::builder() -- 2.30.2