Skip to content

Commit 847f679

Browse files
committed
Allow multiple -d/--dep
Using repeated -d/--dep was broken in the clap upgrade. Fixes #106.
1 parent b719859 commit 847f679

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

src/arguments.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ impl Args {
9292
.help("Add a dependency - either just the package name (for the latest version) or as `name=version`")
9393
.long("dep")
9494
.short('d')
95-
.num_args(1..)
96-
.number_of_values(1)
95+
.action(ArgAction::Append)
9796
)
9897
.arg(Arg::new("extern")
9998
.help("Adds an `#[macro_use] extern crate name;` item for expressions and loop scripts")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
use anyhow::Result;
2+
use serde_json::from_str;
3+
4+
println!("--output--");
5+
println!("Ok");

tests/tests/script.rs

+17
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,20 @@ fn test_extern_c_main() {
281281
)
282282
.unwrap()
283283
}
284+
285+
#[test]
286+
#[cfg_attr(not(feature = "online_tests"), ignore)]
287+
fn test_script_multiple_deps() {
288+
let out = rust_script!(
289+
"-d",
290+
"serde_json=1.0.96",
291+
"-d",
292+
"anyhow=1.0.71",
293+
"tests/data/script-using-anyhow-and-serde.rs"
294+
)
295+
.unwrap();
296+
scan!(out.stdout_output();
297+
("Ok") => ()
298+
)
299+
.unwrap()
300+
}

0 commit comments

Comments
 (0)