chore: update data

This commit is contained in:
Rh4096 2024-12-06 01:23:51 +07:00
parent d98f1deed1
commit 1e68c2ac05
2 changed files with 27 additions and 0 deletions

14
src/cli.rs Normal file
View file

@ -0,0 +1,14 @@
use std::path::PathBuf;
use clap::Parser;
#[derive(Parser, Debug, Clone)]
#[command(version, about, long_about = None)]
#[command(propagate_version = true)]
#[command(rename_all = "kebab-case")]
pub struct AocCli {
#[arg(short, long)]
pub day: u8,
#[arg(short, long, default_value = None)]
pub input: Option<PathBuf>,
}

13
src/utils/macros.rs Normal file
View file

@ -0,0 +1,13 @@
#[macro_export]
macro_rules! map_solution {
($cli:ident : $($day:expr => $sol:expr,)+ $(,)?) => {
match $cli .day {
$($day => {
let sol = $sol;
let input = sol.get_input($cli.input.as_deref())?;
println!("\tp1: {}\n\tp2: {}", sol.part_one(&input)?, sol.part_two(&input)?);
},)+
_ => return Err(Error::UnsupportedDay),
}
};
}