Skip to content

Commit

Permalink
Add clap argument parser
Browse files Browse the repository at this point in the history
The program will accept 2 optional arguments, one to the select the
input folder, the other one to select for folder for the inputs.
  • Loading branch information
Mr-Ker committed Nov 29, 2024
1 parent bfa3683 commit 6cd0e79
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ version = "0.1.0"
edition = "2021"

[dependencies]
clap = { version = "4.5.21", features = ["derive"] }
17 changes: 15 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
fn main() {
println!("Hello, world!");
use clap::Parser;

#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
struct Args {
#[arg(short, long, default_value_t = String::from("input_examples"))]
input_folder: String,
#[arg(short, long, default_value_t = 1)]
day: u8,
}

fn main() {
let args = Args::parse();

println!("Running day {} with input folder <{}>!", args.day, args.input_folder);
}

0 comments on commit 6cd0e79

Please sign in to comment.