mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
fix(cli): support "deno run --v8-flags=--help" without script (#8110)
This commit is contained in:
parent
a4f27c4d57
commit
686a17fc07
1 changed files with 9 additions and 7 deletions
16
cli/flags.rs
16
cli/flags.rs
|
@ -1199,6 +1199,13 @@ Directory arguments are expanded to all contained files matching the glob
|
|||
fn script_arg<'a, 'b>() -> Arg<'a, 'b> {
|
||||
Arg::with_name("script_arg")
|
||||
.multiple(true)
|
||||
// NOTE: these defaults are provided
|
||||
// so `deno run --v8-flags=--help` works
|
||||
// without specifying file to run.
|
||||
.default_value_ifs(&[
|
||||
("v8-flags", Some("--help"), "_"),
|
||||
("v8-flags", Some("-help"), "_"),
|
||||
])
|
||||
.help("Script arg")
|
||||
.value_name("SCRIPT_ARG")
|
||||
}
|
||||
|
@ -1646,17 +1653,12 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn run_v8_flags() {
|
||||
let r = flags_from_vec_safe(svec![
|
||||
"deno",
|
||||
"run",
|
||||
"--v8-flags=--help",
|
||||
"script.ts"
|
||||
]);
|
||||
let r = flags_from_vec_safe(svec!["deno", "run", "--v8-flags=--help"]);
|
||||
assert_eq!(
|
||||
r.unwrap(),
|
||||
Flags {
|
||||
subcommand: DenoSubcommand::Run {
|
||||
script: "script.ts".to_string(),
|
||||
script: "_".to_string(),
|
||||
},
|
||||
v8_flags: Some(svec!["--help"]),
|
||||
..Flags::default()
|
||||
|
|
Loading…
Reference in a new issue