Skip to content

Commit

Permalink
Add cli arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
dloez committed Jul 7, 2023
1 parent 4472f3e commit d97186f
Show file tree
Hide file tree
Showing 3 changed files with 249 additions and 2 deletions.
236 changes: 236 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 @@ -6,6 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = "4.3.11"
glob = "0.3.1"
regex = "1.9.1"
strum = "0.25"
Expand Down
14 changes: 12 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use clap::{arg, Command};
use glob::glob;
use std::path::PathBuf;
use strum::IntoEnumIterator;
Expand Down Expand Up @@ -70,9 +71,18 @@ fn get_spec_files_paths() -> Vec<wrapper::Wrapper> {
}

fn main() {
let wrappers = get_spec_files_paths();
let matches = Command::new("Arcanist")
.version("0.1")
.author("David L. <davidlopez.hellin@outlook.com>")
.about("A 'Mage' like inspired function runner with multi-language support")
.arg(arg!([function_name] "Function to call").required(true))
.get_matches();

let wrappers = get_spec_files_paths();
let function_name = matches
.get_one::<String>("function_name")
.expect("required");
for wrapper in wrappers {
println!("{:?}", wrapper.does_function_exists("example_2"));
println!("{:?}", wrapper.does_function_exists(function_name));
}
}

0 comments on commit d97186f

Please sign in to comment.