advent_of_code/src/main.rs

23 lines
606 B
Rust

use std::env;
fn main() {
let day = match env::args().nth(1) {
Some(arg) => arg.parse().unwrap(),
None => 1
};
let result = match day {
1 => advent_of_code::aoc01::both("./inputs/01-01.txt"),
2 => advent_of_code::aoc02::both("./inputs/02-01.txt"),
3 => advent_of_code::aoc03::both("./inputs/03-01.txt"),
4 => advent_of_code::aoc04::both("./inputs/04-01.txt"),
_ => Err(format!("unsupported day {}", day).into()),
};
match result {
Ok(_) => (),
Err(e) => println!("Error executing day {}: {}", day, e),
}
}