From: Ian Jackson Date: Wed, 4 Aug 2021 00:37:35 +0000 (+0100) Subject: provide for client opts X-Git-Tag: hippotat/1.0.0~354 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=c8dd7861613473187211952111c2ca95c62f0fae;p=hippotat.git provide for client opts Signed-off-by: Ian Jackson --- 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(