From 266a00d98303b245908acbda3a0ed3d2d83f27f0 Mon Sep 17 00:00:00 2001 From: Arthur Pinheiro Date: Wed, 12 Mar 2025 14:18:40 +0100 Subject: [PATCH] feat: use vector for --allowlist and --blocklist for passing multiples --- src/args.rs | 6 ++++-- src/cleaners.rs | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/args.rs b/src/args.rs index 7a00d3b..a1db7e6 100644 --- a/src/args.rs +++ b/src/args.rs @@ -41,13 +41,15 @@ pub struct Args { pub split_to: Option, /// An allowlist of files to keep, in .gitignore format. + /// Can be passed multiple times. /// Note: this will take precedence over all other removal decisions. #[arg(long, value_parser = AbsolutePathBufValueParser::default())] - pub allowlist: Option, + pub allowlist: Vec, /// A blocklist of files to remove, in .gitignore format. + /// Can be passed multiple times. #[arg(long)] - pub blocklist: Option, + pub blocklist: Vec, /// An optional path to save the file graph of the DSO cleaner /// in GraphViz format. Useful for debugging. diff --git a/src/cleaners.rs b/src/cleaners.rs index 925937e..3e2860a 100644 --- a/src/cleaners.rs +++ b/src/cleaners.rs @@ -41,11 +41,11 @@ impl Runner { let removal_fn = Self::new_removal_fn(&args); let mut cleaners: Cleaners = vec![]; - if let Some(wl) = args.allowlist { + for wl in args.allowlist { cleaners.push(Box::new(ListCleaner::new(list::ListType::Allow, wl))); } - if let Some(bl) = args.blocklist { + for bl in args.blocklist { cleaners.push(Box::new(ListCleaner::new(list::ListType::Block, bl))); }