From c8dd7861613473187211952111c2ca95c62f0fae Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 4 Aug 2021 01:37:35 +0100 Subject: [PATCH] provide for client opts Signed-off-by: Ian Jackson --- src/bin/client.rs | 10 +++++++++- src/config.rs | 4 +--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/bin/client.rs b/src/bin/client.rs index 9ae1135..89857d5 100644 --- a/src/bin/client.rs +++ b/src/bin/client.rs @@ -5,6 +5,12 @@ use hippotat::prelude::*; use hippotat_macros::into_crlfs; +#[derive(StructOpt,Debug)] +pub struct Opts { + #[structopt(flatten)] + config: config::Opts, +} + type OutstandingRequest<'r> = Pin> + Send + 'r >>; @@ -280,7 +286,9 @@ async fn run_client( #[tokio::main] async fn main() -> Result<(), AE> { - let ics = config::read(LinkEnd::Client)?; + let opts = Opts::from_args(); + + let ics = config::read(&opts.config, LinkEnd::Client)?; if ics.is_empty() { throw!(anyhow!("no associations with server(s)")); } env_logger::init(); diff --git a/src/config.rs b/src/config.rs index 92c584b..5249d20 100644 --- a/src/config.rs +++ b/src/config.rs @@ -767,9 +767,7 @@ impl InstanceConfig { } #[throws(AE)] -pub fn read(end: LinkEnd) -> Vec { - let opts = config::Opts::from_args(); - +pub fn read(opts: &Opts, end: LinkEnd) -> Vec { let agg = (||{ let mut agg = Aggregate::default(); agg.keys_allowed.extend( -- 2.30.2