Add additional printing info

Make sure when printing meals, there's a note
about canteens without matching meals and canteens
closed on that particular day.
This commit is contained in:
Malte Tammena 2021-10-24 16:47:26 +02:00
parent 070208fb20
commit b763d10616

View file

@ -99,17 +99,22 @@ impl Meal {
println!("\n {}", color!(name; bright_black));
match canteen.meals_at_mut(day)? {
Some(meals) => {
let mut printed_at_least_one_meal = false;
for meal in meals {
let complete = meal.complete()?;
if filter.is_match(&complete) {
let is_fav = favs.is_match(&complete);
println!("{}", *PRE);
complete.print(is_fav);
printed_at_least_one_meal = true;
}
}
if !printed_at_least_one_meal {
println!("{} {}", *PRE, color!("no matching meals found"; dimmed));
}
}
None => {
println!("{} {}", *PRE, color!("no meals listed"; dimmed))
println!("{} {}", *PRE, color!("closed"; dimmed))
}
}
}