job: add processing blacklist to global config

This commit is contained in:
Bruno BELANYI 2021-03-30 16:11:36 +00:00
parent 209e1e58c7
commit 512e6cc4d1
2 changed files with 11 additions and 0 deletions

View file

@ -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);

View file

@ -10,4 +10,8 @@ pub(crate) struct GlobalSettings {
/// List of remote stems to use for every repository
#[serde(default)]
pub additional_remotes: Vec<RepoUrl>,
/// 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<regex::Regex>,
}