From 512e6cc4d1544b47134a665c95dbf1e6fbe5352a Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 30 Mar 2021 16:11:36 +0000 Subject: [PATCH] job: add processing blacklist to global config --- src/job.rs | 7 +++++++ src/settings.rs | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/src/job.rs b/src/job.rs index 2e91cf1..0477704 100644 --- a/src/job.rs +++ b/src/job.rs @@ -190,6 +190,13 @@ impl Job { } pub(crate) fn run(&mut self, homedir: &Path, config: &GlobalSettings) -> anyhow::Result<()> { + if config + .blacklist + .iter() + .any(|re| re.is_match(&self.repo.full_name)) + { + return Ok(()); + } let local_path = homedir.join(&self.repo.full_name); assert!(local_path.is_absolute()); self.local_path = Some(local_path); diff --git a/src/settings.rs b/src/settings.rs index bfe7744..976264f 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -10,4 +10,8 @@ pub(crate) struct GlobalSettings { /// List of remote stems to use for every repository #[serde(default)] pub additional_remotes: Vec, + /// List of regexes, if a repository's name matches any of the, it is not mirrored by `lohr` + /// even if it contains a `.lorh` file. + #[serde(with = "serde_regex")] + pub blacklist: Vec, }