[rust] Allow for running previous days

wip
Alpha Chen 8 years ago
parent ece6b3041d
commit 2044e43b34

@ -1,3 +1,4 @@
use std::env;
use std::io::prelude::*;
use std::io;
@ -7,5 +8,20 @@ use advent_of_code::*;
fn main() {
let mut input = String::new();
io::stdin().read_to_string(&mut input).ok();
println!("{}", day_10::solve(&input));
let solution: String =
match env::args().nth(1).as_ref().map(String::as_ref) {
Some("1") => day_01::solve(&input).to_string(),
Some("2") => day_02::solve(&input).to_string(),
Some("3") => day_03::solve(&input).to_string(),
Some("4") => day_04::solve(&input).to_string(),
Some("5") => day_05::solve(&input).to_string(),
Some("6") => day_06::solve(&input).to_string(),
Some("7") => day_07::solve(&input, "a").to_string(),
Some("8") => day_08::solve(&input).to_string(),
Some("9") => day_09::solve(&input).to_string(),
_ => day_10::solve(&input),
};
println!("{}", solution);
}

Loading…
Cancel
Save