this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

repo: add simple cli

+237 -6
+179
Cargo.lock
··· 3 3 version = 4 4 4 5 5 [[package]] 6 + name = "anstream" 7 + version = "0.6.21" 8 + source = "registry+https://github.com/rust-lang/crates.io-index" 9 + checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" 10 + dependencies = [ 11 + "anstyle", 12 + "anstyle-parse", 13 + "anstyle-query", 14 + "anstyle-wincon", 15 + "colorchoice", 16 + "is_terminal_polyfill", 17 + "utf8parse", 18 + ] 19 + 20 + [[package]] 21 + name = "anstyle" 22 + version = "1.0.13" 23 + source = "registry+https://github.com/rust-lang/crates.io-index" 24 + checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" 25 + 26 + [[package]] 27 + name = "anstyle-parse" 28 + version = "0.2.7" 29 + source = "registry+https://github.com/rust-lang/crates.io-index" 30 + checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" 31 + dependencies = [ 32 + "utf8parse", 33 + ] 34 + 35 + [[package]] 36 + name = "anstyle-query" 37 + version = "1.1.5" 38 + source = "registry+https://github.com/rust-lang/crates.io-index" 39 + checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" 40 + dependencies = [ 41 + "windows-sys", 42 + ] 43 + 44 + [[package]] 45 + name = "anstyle-wincon" 46 + version = "3.0.11" 47 + source = "registry+https://github.com/rust-lang/crates.io-index" 48 + checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" 49 + dependencies = [ 50 + "anstyle", 51 + "once_cell_polyfill", 52 + "windows-sys", 53 + ] 54 + 55 + [[package]] 6 56 name = "aoc25" 7 57 version = "0.1.0" 58 + dependencies = [ 59 + "clap", 60 + ] 61 + 62 + [[package]] 63 + name = "clap" 64 + version = "4.5.53" 65 + source = "registry+https://github.com/rust-lang/crates.io-index" 66 + checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8" 67 + dependencies = [ 68 + "clap_builder", 69 + "clap_derive", 70 + ] 71 + 72 + [[package]] 73 + name = "clap_builder" 74 + version = "4.5.53" 75 + source = "registry+https://github.com/rust-lang/crates.io-index" 76 + checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00" 77 + dependencies = [ 78 + "anstream", 79 + "anstyle", 80 + "clap_lex", 81 + "strsim", 82 + ] 83 + 84 + [[package]] 85 + name = "clap_derive" 86 + version = "4.5.49" 87 + source = "registry+https://github.com/rust-lang/crates.io-index" 88 + checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" 89 + dependencies = [ 90 + "heck", 91 + "proc-macro2", 92 + "quote", 93 + "syn", 94 + ] 95 + 96 + [[package]] 97 + name = "clap_lex" 98 + version = "0.7.6" 99 + source = "registry+https://github.com/rust-lang/crates.io-index" 100 + checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" 101 + 102 + [[package]] 103 + name = "colorchoice" 104 + version = "1.0.4" 105 + source = "registry+https://github.com/rust-lang/crates.io-index" 106 + checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" 107 + 108 + [[package]] 109 + name = "heck" 110 + version = "0.5.0" 111 + source = "registry+https://github.com/rust-lang/crates.io-index" 112 + checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 113 + 114 + [[package]] 115 + name = "is_terminal_polyfill" 116 + version = "1.70.2" 117 + source = "registry+https://github.com/rust-lang/crates.io-index" 118 + checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" 119 + 120 + [[package]] 121 + name = "once_cell_polyfill" 122 + version = "1.70.2" 123 + source = "registry+https://github.com/rust-lang/crates.io-index" 124 + checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" 125 + 126 + [[package]] 127 + name = "proc-macro2" 128 + version = "1.0.103" 129 + source = "registry+https://github.com/rust-lang/crates.io-index" 130 + checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" 131 + dependencies = [ 132 + "unicode-ident", 133 + ] 134 + 135 + [[package]] 136 + name = "quote" 137 + version = "1.0.42" 138 + source = "registry+https://github.com/rust-lang/crates.io-index" 139 + checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" 140 + dependencies = [ 141 + "proc-macro2", 142 + ] 143 + 144 + [[package]] 145 + name = "strsim" 146 + version = "0.11.1" 147 + source = "registry+https://github.com/rust-lang/crates.io-index" 148 + checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" 149 + 150 + [[package]] 151 + name = "syn" 152 + version = "2.0.111" 153 + source = "registry+https://github.com/rust-lang/crates.io-index" 154 + checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" 155 + dependencies = [ 156 + "proc-macro2", 157 + "quote", 158 + "unicode-ident", 159 + ] 160 + 161 + [[package]] 162 + name = "unicode-ident" 163 + version = "1.0.22" 164 + source = "registry+https://github.com/rust-lang/crates.io-index" 165 + checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" 166 + 167 + [[package]] 168 + name = "utf8parse" 169 + version = "0.2.2" 170 + source = "registry+https://github.com/rust-lang/crates.io-index" 171 + checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" 172 + 173 + [[package]] 174 + name = "windows-link" 175 + version = "0.2.1" 176 + source = "registry+https://github.com/rust-lang/crates.io-index" 177 + checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" 178 + 179 + [[package]] 180 + name = "windows-sys" 181 + version = "0.61.2" 182 + source = "registry+https://github.com/rust-lang/crates.io-index" 183 + checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" 184 + dependencies = [ 185 + "windows-link", 186 + ]
+1
Cargo.toml
··· 4 4 edition = "2024" 5 5 6 6 [dependencies] 7 + clap = { version = "4", features = ["derive"] }
+57 -6
src/main.rs
··· 1 1 mod solutions; 2 2 3 - use solutions::{Day, Day3}; 3 + use clap::Parser; 4 + use solutions::*; 5 + 6 + #[derive(Parser)] 7 + #[command(name = "aoc25")] 8 + #[command(about = "Advent of Code 2025 solutions")] 9 + struct Args { 10 + /// Day to run (1-25) 11 + day: Option<u32>, 12 + /// Run all implemented days 13 + #[arg(short, long)] 14 + all: bool, 15 + /// Run with test input 16 + #[arg(short, long)] 17 + test: bool, 18 + /// Run specific part (1 or 2) 19 + #[arg(short, long)] 20 + part: Option<u8>, 21 + } 22 + 23 + fn run<D: Day>(d: D, day: u32, args: &Args) { 24 + let run_part1 = args.part.is_none() || args.part == Some(1); 25 + let run_part2 = args.part.is_none() || args.part == Some(2); 26 + 27 + let mut results = Vec::new(); 28 + if run_part1 { 29 + results.push(d.part1().to_string()); 30 + } 31 + if run_part2 { 32 + results.push(d.part2().to_string()); 33 + } 34 + if args.all { 35 + println!("Day {}: {}", day, results.join(" ")); 36 + } else { 37 + println!("{}", results.join(" ")); 38 + } 39 + } 40 + 41 + fn run_day(day: u32, args: &Args) { 42 + match day { 43 + 1 => run(Day1::new(args.test), day, args), 44 + 2 => run(Day2::new(args.test), day, args), 45 + 3 => run(Day3::new(args.test), day, args), 46 + d => eprintln!("Day {} not implemented", d), 47 + } 48 + } 4 49 5 50 fn main() { 6 - //let day1 = Day1::new("inputs/1.txt"); 7 - //let day2 = Day2::new("inputs/1.txt"); 8 - let day = Day3::new(false); 9 - // println!("Part 1: {}", day.part1()); 10 - println!("Part 2: {}", day.part2()); 51 + let args = Args::parse(); 52 + 53 + if args.all { 54 + for day in 1..=3 { 55 + run_day(day, &args); 56 + } 57 + } else if let Some(day) = args.day { 58 + run_day(day, &args); 59 + } else { 60 + eprintln!("Please specify a day or use --all"); 61 + } 11 62 }