Skip to content

Commit

Permalink
feat: Add argparse to main.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
mgallegos4 committed Dec 26, 2024
1 parent da9e005 commit d272732
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 5 deletions.
120 changes: 120 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ walkdir = "2.5.0"
rayon = "1.10.0"
rusqlite = { version = "0.32.1", features = ["bundled"] }
lazy_static = "1.5.0"
clap = { version = "4.5.23", features = ["derive"] }
17 changes: 12 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@
//
// SPDX-License-Identifier: MIT

use std::env;
use clap::Parser;

#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
#[command(arg_required_else_help(true))]

struct Args {
#[arg(help = "The path to a directory or a file to be analyzed.", index = 1)]
path: String,
}

fn main() {
let args: Vec<String> = env::args().collect();
println!("{args:?}");
let arg_path = &args[1];
dapper::run(arg_path);
let args = Args::parse();
dapper::run(&args.path);
}

0 comments on commit d272732

Please sign in to comment.