feat: handle category without repos

This is a dirty hack, but we won't have to duplicate it when the kinds
field is done, so I don't feel /too/ bad about including it :D

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
This commit is contained in:
Christina Sørensen 2023-07-24 07:00:48 +02:00
parent 49a6c65783
commit e12dae4ebc

View file

@ -600,8 +600,13 @@ impl Config {
/// ];
/// ```
pub fn all_on_all(&self, closures: Vec<SeriesItem>, break_on_err: bool) {
// HACK: creates a empty repo, that is used if a category doesn't have
// any repos or don't define the repo field
let tmp: HashMap<String, Repo> = HashMap::new();
for category in self.categories.values() {
for (_, repo) in category.repos.as_ref().expect("failed to get repos").iter() {
// HACK: if the repo doesn't exist here, we inject tmp
for (_, repo) in category.repos.as_ref().unwrap_or_else(|| &tmp).iter() {
use RepoKinds::*;
match &repo.kind {
Some(GitRepo) => {