Revert "feat(BREAKING/compile): require providing -- for script arguments" (#31505)

Reverts denoland/deno#31296
This commit is contained in:
David Sherret 2025-12-05 16:17:43 -05:00 committed by GitHub
parent a39796500d
commit 3089aa8690
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 17 deletions

View file

@ -2646,16 +2646,8 @@ On the first invocation of `deno compile`, Deno will download the relevant binar
.arg(env_file_arg())
.arg(
script_arg()
.num_args(0..=1)
.required_unless_present("help"),
)
.arg(
Arg::new("args")
.num_args(0..)
.help("Arguments to provide for Deno.args (must be preceded by `--`)")
.action(ArgAction::Append)
.value_name("ARGS")
.last(true)
.required_unless_present("help")
.trailing_var_arg(true),
)
})
}
@ -5654,11 +5646,9 @@ fn compile_parse(
flags.type_check_mode = TypeCheckMode::Local;
runtime_args_parse(flags, matches, true, false, true)?;
let source_file = matches.remove_one::<String>("script_arg").unwrap();
let args = matches
.remove_many::<String>("args")
.unwrap_or_default()
.collect();
let mut script = matches.remove_many::<String>("script_arg").unwrap();
let source_file = script.next().unwrap();
let args = script.collect();
let output = matches.remove_one::<String>("output");
let target = matches.remove_one::<String>("target");
let icon = matches.remove_one::<String>("icon");
@ -11899,7 +11889,7 @@ mod tests {
#[test]
fn compile_with_flags() {
#[rustfmt::skip]
let r = flags_from_vec(svec!["deno", "compile", "--include", "include.txt", "--exclude", "exclude.txt", "--import-map", "import_map.json", "--no-code-cache", "--no-remote", "--config", "tsconfig.json", "--no-check", "--unsafely-ignore-certificate-errors", "--reload", "--lock", "lock.json", "--cert", "example.crt", "--cached-only", "--location", "https:foo", "--allow-read", "--allow-net", "--v8-flags=--help", "--seed", "1", "--no-terminal", "--icon", "favicon.ico", "--output", "colors", "--env=.example.env", "https://examples.deno.land/color-logging.ts", "--", "foo", "bar", "-p", "8080"]);
let r = flags_from_vec(svec!["deno", "compile", "--include", "include.txt", "--exclude", "exclude.txt", "--import-map", "import_map.json", "--no-code-cache", "--no-remote", "--config", "tsconfig.json", "--no-check", "--unsafely-ignore-certificate-errors", "--reload", "--lock", "lock.json", "--cert", "example.crt", "--cached-only", "--location", "https:foo", "--allow-read", "--allow-net", "--v8-flags=--help", "--seed", "1", "--no-terminal", "--icon", "favicon.ico", "--output", "colors", "--env=.example.env", "https://examples.deno.land/color-logging.ts", "foo", "bar", "-p", "8080"]);
assert_eq!(
r.unwrap(),
Flags {