summaryrefslogtreecommitdiff
path: root/cli/flags.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/flags.rs')
-rw-r--r--cli/flags.rs29
1 files changed, 25 insertions, 4 deletions
diff --git a/cli/flags.rs b/cli/flags.rs
index 1eda8765e..a0d322e56 100644
--- a/cli/flags.rs
+++ b/cli/flags.rs
@@ -401,8 +401,10 @@ fn fetch_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) {
importmap_arg_parse(flags, matches);
config_arg_parse(flags, matches);
no_remote_arg_parse(flags, matches);
- if let Some(file) = matches.value_of("file") {
- flags.argv.push(file.into());
+ if let Some(files) = matches.values_of("file") {
+ for file in files {
+ flags.argv.push(file.into());
+ }
}
}
@@ -525,7 +527,7 @@ fn fmt_subcommand<'a, 'b>() -> App<'a, 'b> {
deno fmt
deno fmt myfile1.ts myfile2.ts
-
+
deno fmt --check",
)
.arg(
@@ -669,7 +671,12 @@ fn fetch_subcommand<'a, 'b>() -> App<'a, 'b> {
.arg(importmap_arg())
.arg(config_arg())
.arg(no_remote_arg())
- .arg(Arg::with_name("file").takes_value(true).required(true))
+ .arg(
+ Arg::with_name("file")
+ .takes_value(true)
+ .required(true)
+ .min_values(1),
+ )
.about("Fetch the dependencies")
.long_about(
"Fetch and compile remote dependencies recursively.
@@ -1684,6 +1691,20 @@ mod tests {
}
#[test]
+ fn fetch_multiple() {
+ let r =
+ flags_from_vec_safe(svec!["deno", "fetch", "script.ts", "script_two.ts"]);
+ assert_eq!(
+ r.unwrap(),
+ DenoFlags {
+ subcommand: DenoSubcommand::Fetch,
+ argv: svec!["deno", "script.ts", "script_two.ts"],
+ ..DenoFlags::default()
+ }
+ );
+ }
+
+ #[test]
fn run_seed() {
let r =
flags_from_vec_safe(svec!["deno", "run", "--seed", "250", "script.ts"]);