From: Ian Jackson Date: Tue, 12 Jan 2021 19:37:45 +0000 (+0000) Subject: otterlib: Allow multiple libs separated with space or comma X-Git-Tag: otter-0.3.0~61 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=f58fdca27f94358bb3871282581417affbffcc50;p=otter.git otterlib: Allow multiple libs separated with space or comma Signed-off-by: Ian Jackson --- diff --git a/src/bin/otterlib.rs b/src/bin/otterlib.rs index 91e19e1b..42d4c35d 100644 --- a/src/bin/otterlib.rs +++ b/src/bin/otterlib.rs @@ -201,14 +201,23 @@ fn main() { .parse_env("OTTERLIB_LOG") .init(); - let libs = Config1::PathGlob(opts.libs.clone()); - load(&vec![libs.clone()])?; + const SPLIT: &[char] = &[',', ' ']; + + for libs in opts.libs.split(SPLIT) { + let tlibs = Config1::PathGlob(libs.to_owned()); + load(&vec![tlibs.clone()])?; + } let mut items : Vec = libs_list() .into_iter() .map(|lib| { let contents = libs_lookup(&lib)?; - let items = contents.list_glob(&opts.items)?; + let items = opts.items + .split(SPLIT) + .map(|items| contents.list_glob(items)) + .collect::,_>>()? + .into_iter() + .flatten(); Ok::<_,AE>((lib, items)) }) .collect::,_>>()?