1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

fix(compile): support providing flags as args (#20422)

Closes #20413
This commit is contained in:
David Sherret 2023-09-08 12:14:59 -05:00 committed by GitHub
parent 1b7d5937d9
commit 9cac5601b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1111,7 +1111,6 @@ supported in canary.
)
.defer(|cmd| {
runtime_args(cmd, true, false)
.arg(script_arg().required(true))
.arg(check_arg(true))
.arg(
Arg::new("include")
@ -1152,6 +1151,7 @@ supported in canary.
.action(ArgAction::SetTrue),
)
.arg(executable_ext_arg())
.arg(script_arg().required(true).trailing_var_arg(true))
})
}
@ -7262,14 +7262,14 @@ mod tests {
#[test]
fn compile_with_flags() {
#[rustfmt::skip]
let r = flags_from_vec(svec!["deno", "compile", "--import-map", "import_map.json", "--no-remote", "--config", "tsconfig.json", "--no-check", "--unsafely-ignore-certificate-errors", "--reload", "--lock", "lock.json", "--lock-write", "--cert", "example.crt", "--cached-only", "--location", "https:foo", "--allow-read", "--allow-net", "--v8-flags=--help", "--seed", "1", "--no-terminal", "--output", "colors", "https://deno.land/std/examples/colors.ts", "foo", "bar"]);
let r = flags_from_vec(svec!["deno", "compile", "--import-map", "import_map.json", "--no-remote", "--config", "tsconfig.json", "--no-check", "--unsafely-ignore-certificate-errors", "--reload", "--lock", "lock.json", "--lock-write", "--cert", "example.crt", "--cached-only", "--location", "https:foo", "--allow-read", "--allow-net", "--v8-flags=--help", "--seed", "1", "--no-terminal", "--output", "colors", "https://deno.land/std/examples/colors.ts", "foo", "bar", "-p", "8080"]);
assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Compile(CompileFlags {
source_file: "https://deno.land/std/examples/colors.ts".to_string(),
output: Some(PathBuf::from("colors")),
args: svec!["foo", "bar"],
args: svec!["foo", "bar", "-p", "8080"],
target: None,
no_terminal: true,
include: vec![]