From f58fdca27f94358bb3871282581417affbffcc50 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 12 Jan 2021 19:37:45 +0000 Subject: [PATCH] otterlib: Allow multiple libs separated with space or comma Signed-off-by: Ian Jackson --- src/bin/otterlib.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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::,_>>()? -- 2.30.2