fn main() {
let args: Vec<String> = 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();
}