feat: make time command less noisy

This commit is contained in:
Tristan Guichaoua 2023-12-11 12:32:53 +01:00
parent c82e1e2c08
commit 0686723abf

View file

@ -10,28 +10,28 @@ use super::{
pub fn run_multi(days_to_run: &HashSet<Day>, is_release: bool, is_timed: bool) -> Option<Timings> { pub fn run_multi(days_to_run: &HashSet<Day>, is_release: bool, is_timed: bool) -> Option<Timings> {
let mut timings: Vec<Timing> = Vec::with_capacity(days_to_run.len()); let mut timings: Vec<Timing> = Vec::with_capacity(days_to_run.len());
all_days().for_each(|day| { let mut need_space = false;
if day > 1 { // NOTE: we didn't want duplicate day value, but we want days to be sorted.
println!(); all_days()
} .filter(|day| days_to_run.contains(day))
.for_each(|day| {
if need_space {
println!();
}
need_space = true;
println!("{ANSI_BOLD}Day {day}{ANSI_RESET}"); println!("{ANSI_BOLD}Day {day}{ANSI_RESET}");
println!("------"); println!("------");
if !days_to_run.contains(&day) { let output = child_commands::run_solution(day, is_timed, is_release).unwrap();
println!("Skipped.");
return;
}
let output = child_commands::run_solution(day, is_timed, is_release).unwrap(); if output.is_empty() {
println!("Not solved.");
if output.is_empty() { } else {
println!("Not solved."); let val = child_commands::parse_exec_time(&output, day);
} else { timings.push(val);
let val = child_commands::parse_exec_time(&output, day); }
timings.push(val); });
}
});
if is_timed { if is_timed {
let timings = Timings { data: timings }; let timings = Timings { data: timings };