2021-12-29 19:14:40 +01:00
|
|
|
use aoc::{ANSI_BOLD, ANSI_ITALIC, ANSI_RESET};
|
2021-12-29 14:36:48 +01:00
|
|
|
use std::process::Command;
|
2021-12-29 14:12:01 +01:00
|
|
|
|
|
|
|
fn main() {
|
2021-12-29 19:14:40 +01:00
|
|
|
let total: f64 = (1..=25)
|
|
|
|
.map(|day| {
|
|
|
|
let day = format!("{:02}", day);
|
2021-12-29 14:36:48 +01:00
|
|
|
|
2021-12-29 19:14:40 +01:00
|
|
|
let cmd = Command::new("cargo")
|
|
|
|
.args(&["run", "--release", "--bin", &day])
|
|
|
|
.output()
|
|
|
|
.unwrap();
|
2021-12-29 14:12:01 +01:00
|
|
|
|
2021-12-29 19:14:40 +01:00
|
|
|
println!("----------");
|
|
|
|
println!("{}| Day {} |{}", ANSI_BOLD, day, ANSI_RESET);
|
|
|
|
println!("----------");
|
|
|
|
|
|
|
|
let output = String::from_utf8(cmd.stdout).unwrap();
|
|
|
|
let is_empty = output.is_empty();
|
|
|
|
|
2022-10-29 17:04:13 +02:00
|
|
|
println!("{}", if is_empty { "Not solved." } else { &output.trim() });
|
2021-12-29 19:14:40 +01:00
|
|
|
|
|
|
|
if is_empty {
|
|
|
|
0_f64
|
2021-12-29 14:36:48 +01:00
|
|
|
} else {
|
2021-12-29 19:14:40 +01:00
|
|
|
aoc::parse_exec_time(&output)
|
2021-12-29 14:36:48 +01:00
|
|
|
}
|
2021-12-29 19:14:40 +01:00
|
|
|
})
|
|
|
|
.sum();
|
|
|
|
|
|
|
|
println!(
|
|
|
|
"{}Total:{} {}{:.2}ms{}",
|
|
|
|
ANSI_BOLD, ANSI_RESET, ANSI_ITALIC, total, ANSI_RESET
|
|
|
|
);
|
2021-12-29 14:12:01 +01:00
|
|
|
}
|