summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/args/flags.rs19
-rw-r--r--cli/tools/task.rs14
2 files changed, 13 insertions, 20 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]
diff --git a/cli/tools/task.rs b/cli/tools/task.rs
index e806d586c..ae91f53a7 100644
--- a/cli/tools/task.rs
+++ b/cli/tools/task.rs
@@ -36,19 +36,7 @@ pub async fn execute_script(
let cli_options = factory.cli_options()?;
let start_dir = &cli_options.start_dir;
if !start_dir.has_deno_or_pkg_json() {
- if task_flags.is_run {
- bail!(
- r#"deno run couldn't find deno.json(c).
-If you meant to run a script, specify it, e.g., `deno run ./script.ts`.
-To run a task, ensure the config file exists.
-Examples:
-- Script: `deno run ./script.ts`
-- Task: `deno run dev`
-See https://docs.deno.com/go/config"#
- )
- } else {
- bail!("deno task couldn't find deno.json(c). See https://docs.deno.com/go/config")
- }
+ bail!("deno task couldn't find deno.json(c). See https://docs.deno.com/go/config")
}
let force_use_pkg_json =
std::env::var_os(crate::task_runner::USE_PKG_JSON_HIDDEN_ENV_VAR_NAME)