feat: added repo kinds

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
This commit is contained in:
Christina Sørensen 2023-07-17 11:16:12 +02:00
parent b345ab7e4e
commit 0d6afbc772
Signed by: cafkafk
GPG key ID: CDDC792F655251ED

View file

@ -321,22 +321,41 @@ macro_rules! run_series {
($conf:ident, $closures:ident) => { ($conf:ident, $closures:ident) => {
for category in $conf.categories.values() { for category in $conf.categories.values() {
for (_, repo) in category.repos.as_ref().expect("failed to get repos").iter() { for (_, repo) in category.repos.as_ref().expect("failed to get repos").iter() {
use RepoKinds::*;
match &repo.kind {
Some(GitRepo) => {
for instruction in &$closures { for instruction in &$closures {
let f = &instruction.closure; let f = &instruction.closure;
let op = instruction.operation; let op = instruction.operation;
if !settings::QUIET.load(std::sync::atomic::Ordering::Relaxed) { if !settings::QUIET.load(std::sync::atomic::Ordering::Relaxed) {
let mut sp = let mut sp = Spinner::new(
Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op)); Spinners::Dots10,
format!("{}: {}", repo.name, op),
);
if f(repo) { if f(repo) {
sp.stop_and_persist(success_str(), format!("{}: {}", repo.name, op)); sp.stop_and_persist(
success_str(),
format!("{}: {}", repo.name, op),
);
} else { } else {
sp.stop_and_persist(failure_str(), format!("{}: {}", repo.name, op)); sp.stop_and_persist(
failure_str(),
format!("{}: {}", repo.name, op),
);
} }
} else { } else {
f(repo); f(repo);
} }
} }
} }
None => {
println!("unknown kind {:?}", repo.kind)
}
Some(kind) => {
println!("unknown kind {kind:?}")
}
}
}
} }
}; };
} }