Add a way to select each day.
This commit is contained in:
parent
c5e0ac820a
commit
79531921f3
12
src/main.rs
12
src/main.rs
|
@ -1,3 +1,4 @@
|
|||
use std::env;
|
||||
use std::io;
|
||||
|
||||
fn get_calibration_digits() -> u32 {
|
||||
|
@ -98,5 +99,14 @@ fn get_calibration_digits_alnum() -> u32 {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
println!("Sum: {}", get_calibration_digits_alnum());
|
||||
let args: Vec<String> = env::args().collect();
|
||||
if args.len() < 2 {
|
||||
println!("Select a day (i.e. day1a, day1b)");
|
||||
return;
|
||||
}
|
||||
match args[1].as_str() {
|
||||
"day1a" => println!("Sum: {}", get_calibration_digits()),
|
||||
"day1b" => println!("Sum: {}", get_calibration_digits_alnum()),
|
||||
_ => println!("Unrecognized day: {}", args[1]),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue