summaryrefslogtreecommitdiff
path: root/cli/args
diff options
context:
space:
mode:
authorLeo Kettmeir <crowlkats@toaxl.com>2024-09-18 11:36:37 -0700
committerGitHub <noreply@github.com>2024-09-18 20:36:37 +0200
commitc90b07457958518a8830798d8800f647f897d12f (patch)
treeac76cc6d777302199e4b94d43e6d64b9f9130a4b /cli/args
parent49a0b7ab938145730354b7d6e575075b5e406622 (diff)
fix(flags): don't treat empty run command as task subcommand (#25708)
Diffstat (limited to 'cli/args')
-rw-r--r--cli/args/flags.rs19
1 files changed, 12 insertions, 7 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index 765cdf76a..5d3929748 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -4679,7 +4679,7 @@ fn repl_parse(
fn run_parse(
flags: &mut Flags,
matches: &mut ArgMatches,
- app: Command,
+ mut app: Command,
bare: bool,
) -> clap::error::Result<()> {
runtime_args_parse(flags, matches, true, true)?;
@@ -4701,11 +4701,16 @@ fn run_parse(
"[SCRIPT_ARG] may only be omitted with --v8-flags=--help, else to use the repl with arguments, please use the `deno repl` subcommand",
));
} else {
- flags.subcommand = DenoSubcommand::Task(TaskFlags {
- cwd: None,
- task: None,
- is_run: true,
- });
+ return Err(
+ app
+ .get_subcommands_mut()
+ .find(|subcommand| subcommand.get_name() == "run")
+ .unwrap()
+ .error(
+ clap::error::ErrorKind::MissingRequiredArgument,
+ "[SCRIPT_ARG] may only be omitted with --v8-flags=--help",
+ ),
+ );
}
Ok(())
@@ -5927,7 +5932,7 @@ mod tests {
);
let r = flags_from_vec(svec!["deno", "run", "--v8-flags=--expose-gc"]);
- assert!(r.is_ok());
+ assert!(r.is_err());
}
#[test]