From: Jack Kinsey Date: Thu, 5 Dec 2024 03:55:11 +0000 (-0500) Subject: Add support for running every day X-Git-Url: http://git.jkinsey.net/?a=commitdiff_plain;h=7b9676bcf8fcfe794478cc4ff6d9598b67fc8780;p=adventofcode2024.git Add support for running every day --- diff --git a/src/main.rs b/src/main.rs index ca144b9..ffc622c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -56,14 +56,18 @@ const DAYS: [(Part, Part); 4] = [ fn main() { let args: Vec = std::env::args().collect(); - let day: usize = args - .get(1) - .expect("Please provide a day.") - .parse() - .expect("The day should be a number."); - if day < 1 || day > DAYS.len() { - panic!("That day hasn't been implemented yet!"); + let arg = args.get(1).expect("Please provide a day."); + if arg == "all" { + for day in DAYS { + day.0(); + day.1(); + } + } else { + let day: usize = arg.parse().expect("The day should be a number."); + if day < 1 || day > DAYS.len() { + panic!("That day hasn't been implemented yet!"); + } + DAYS[day - 1].0(); + DAYS[day - 1].1(); } - DAYS[day - 1].0(); - DAYS[day - 1].1(); }