use clap::{app_from_crate, crate_authors, crate_description, crate_name, crate_version, Arg};
use std::fs;
fn main() {
include_str!("../Cargo.toml");
let matches = app_from_crate!()
.arg(
Arg::with_name("file")
.short("f")
.long("file")
.takes_value(true)
.help("Plaintext file containing puzzle input. Defaults to day<N>.txt"),
)
.arg(
Arg::with_name("day")
.short("d")
.long("day")
.takes_value(true)
.help("Day of puzzle you want to solve"),
)
.get_matches();
let day = matches
.value_of("day")
.expect("You must specify the day of the puzzle!");
let default = format!("day{}.txt", day);
let puzzle_input_file = matches.value_of("file").unwrap_or(&default);
let input = fs::read_to_string(puzzle_input_file).expect("Error while reading file");
let solver = aoc2021::new_solver(day, &input).expect("Not a valid day!");
solver.solve();
}