mirror of
https://github.com/Rhelvetican/aoc2024.git
synced 2024-12-23 06:51:40 +00:00
chore: update data
This commit is contained in:
parent
d98f1deed1
commit
1e68c2ac05
2 changed files with 27 additions and 0 deletions
14
src/cli.rs
Normal file
14
src/cli.rs
Normal 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
13
src/utils/macros.rs
Normal 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),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue