From 9e4b5cef2ec504077c716004756d70ec7cfe44ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Mon, 17 Jul 2023 11:16:12 +0200 Subject: [PATCH] feat: added repo kinds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christina Sørensen --- src/git.rs | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/src/git.rs b/src/git.rs index f1e7927..d4eb97e 100644 --- a/src/git.rs +++ b/src/git.rs @@ -321,19 +321,38 @@ macro_rules! run_series { ($conf:ident, $closures:ident) => { for category in $conf.categories.values() { for (_, repo) in category.repos.as_ref().expect("failed to get repos").iter() { - for instruction in &$closures { - let f = &instruction.closure; - let op = instruction.operation; - if !settings::QUIET.load(std::sync::atomic::Ordering::Relaxed) { - let mut sp = - Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op)); - if f(repo) { - sp.stop_and_persist(success_str(), format!("{}: {}", repo.name, op)); - } else { - sp.stop_and_persist(failure_str(), format!("{}: {}", repo.name, op)); + use RepoKinds::*; + match &repo.kind { + Some(GitRepo) => { + for instruction in &$closures { + let f = &instruction.closure; + let op = instruction.operation; + if !settings::QUIET.load(std::sync::atomic::Ordering::Relaxed) { + let mut sp = Spinner::new( + Spinners::Dots10, + format!("{}: {}", repo.name, op), + ); + if f(repo) { + sp.stop_and_persist( + success_str(), + format!("{}: {}", repo.name, op), + ); + } else { + sp.stop_and_persist( + failure_str(), + format!("{}: {}", repo.name, op), + ); + } + } else { + f(repo); + } } - } else { - f(repo); + } + None => { + println!("unknown kind {:?}", repo.kind) + } + Some(kind) => { + println!("unknown kind {kind:?}") } } }