advent_of_code/src/main.rs

25 lines
734 B
Rust
Raw Permalink Normal View History

2020-12-06 20:11:09 +01:00
use std::env;
2020-12-02 06:15:53 +01:00
2020-12-06 20:11:09 +01:00
fn main() {
let day = match env::args().nth(1) {
Some(arg) => arg.parse().unwrap(),
None => 1
};
2020-12-02 06:15:53 +01:00
2020-12-06 20:11:09 +01:00
let result = match day {
2020-12-07 02:02:00 +01:00
1 => advent_of_code::aoc01::both("./inputs/01-01.txt"),
2 => advent_of_code::aoc02::both("./inputs/02-01.txt"),
2020-12-07 03:42:15 +01:00
3 => advent_of_code::aoc03::both("./inputs/03-01.txt"),
2020-12-07 07:38:13 +01:00
4 => advent_of_code::aoc04::both("./inputs/04-01.txt"),
2020-12-07 08:06:49 +01:00
5 => advent_of_code::aoc05::both("./inputs/05-01.txt"),
2020-12-07 09:12:08 +01:00
6 => advent_of_code::aoc06::both("./inputs/06-01.txt"),
2020-12-06 20:11:09 +01:00
_ => Err(format!("unsupported day {}", day).into()),
};
2020-12-02 06:15:53 +01:00
2020-12-06 20:11:09 +01:00
match result {
Ok(_) => (),
Err(e) => println!("Error executing day {}: {}", day, e),
}
2020-12-02 06:15:53 +01:00
}