DEVELOPMENT ENVIRONMENT

~liljamo/aoc2024

ref: 9de0f35a56cf7917ccb7d134a52d3dbf0165f433 aoc2024/src/main.rs -rw-r--r-- 1014 bytes
9de0f35aJonni Liljamo feat: day4 a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#![allow(clippy::comparison_chain)]
#![allow(clippy::while_let_loop)]
#![allow(clippy::needless_range_loop)]
use std::path::PathBuf;

use clap::{Parser, Subcommand};

mod day1;
mod day2;
mod day3;
mod day4;

#[derive(Parser)]
struct Args {
    #[command(subcommand)]
    day: DayArgs,
}

#[derive(Subcommand)]
enum DayArgs {
    Day1 {
        #[arg(short)]
        input: PathBuf,
    },
    Day2 {
        #[arg(short)]
        input: PathBuf,
    },
    Day3 {
        #[arg(short)]
        input: PathBuf,
    },
    Day4 {
        #[arg(short)]
        input: PathBuf,
    },
}

fn main() -> anyhow::Result<()> {
    let args = Args::parse();

    match args.day {
        DayArgs::Day1 { input } => {
            day1::solve(&input)?;
        }
        DayArgs::Day2 { input } => {
            day2::solve(&input)?;
        }
        DayArgs::Day3 { input } => {
            day3::solve(&input)?;
        }
        DayArgs::Day4 { input } => {
            day4::solve(&input)?;
        }
    }

    Ok(())
}