mirror of
https://github.com/denoland/deno.git
synced 2025-03-04 01:44:26 -05:00
Fix: deno --v8-options does not print v8 options (#2277)
This commit is contained in:
parent
4d4dcafb96
commit
bf9b0c8231
7 changed files with 15 additions and 11 deletions
12
cli/flags.rs
12
cli/flags.rs
|
@ -2,7 +2,6 @@
|
||||||
use clap::{App, AppSettings, Arg, ArgMatches, SubCommand};
|
use clap::{App, AppSettings, Arg, ArgMatches, SubCommand};
|
||||||
|
|
||||||
// Creates vector of strings, Vec<String>
|
// Creates vector of strings, Vec<String>
|
||||||
#[cfg(test)]
|
|
||||||
macro_rules! svec {
|
macro_rules! svec {
|
||||||
($($x:expr),*) => (vec![$($x.to_string()),*]);
|
($($x:expr),*) => (vec![$($x.to_string()),*]);
|
||||||
}
|
}
|
||||||
|
@ -23,7 +22,6 @@ pub struct DenoFlags {
|
||||||
pub allow_run: bool,
|
pub allow_run: bool,
|
||||||
pub allow_high_precision: bool,
|
pub allow_high_precision: bool,
|
||||||
pub no_prompts: bool,
|
pub no_prompts: bool,
|
||||||
pub v8_help: bool,
|
|
||||||
pub v8_flags: Option<Vec<String>>,
|
pub v8_flags: Option<Vec<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,15 +243,17 @@ pub fn parse_flags(matches: ArgMatches) -> DenoFlags {
|
||||||
flags.no_prompts = true;
|
flags.no_prompts = true;
|
||||||
}
|
}
|
||||||
if matches.is_present("v8-options") {
|
if matches.is_present("v8-options") {
|
||||||
flags.v8_help = true;
|
let v8_flags = svec!["deno", "--help"];
|
||||||
|
flags.v8_flags = Some(v8_flags);
|
||||||
}
|
}
|
||||||
if matches.is_present("v8-flags") {
|
if matches.is_present("v8-flags") {
|
||||||
let v8_flags: Vec<String> = matches
|
let mut v8_flags: Vec<String> = matches
|
||||||
.values_of("v8-flags")
|
.values_of("v8-flags")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.map(String::from)
|
.map(String::from)
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
v8_flags.insert(0, "deno".to_string());
|
||||||
flags.v8_flags = Some(v8_flags);
|
flags.v8_flags = Some(v8_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ mod tests {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
flags,
|
flags,
|
||||||
DenoFlags {
|
DenoFlags {
|
||||||
v8_help: true,
|
v8_flags: Some(svec!["deno", "--help"]),
|
||||||
..DenoFlags::default()
|
..DenoFlags::default()
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -420,7 +420,7 @@ mod tests {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
flags,
|
flags,
|
||||||
DenoFlags {
|
DenoFlags {
|
||||||
v8_flags: Some(svec!["--expose-gc", "--gc-stats=1"]),
|
v8_flags: Some(svec!["deno", "--expose-gc", "--gc-stats=1"]),
|
||||||
..DenoFlags::default()
|
..DenoFlags::default()
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -258,11 +258,6 @@ fn main() {
|
||||||
let args: Vec<String> = env::args().collect();
|
let args: Vec<String> = env::args().collect();
|
||||||
let (flags, subcommand, argv) = flags::flags_from_vec(args);
|
let (flags, subcommand, argv) = flags::flags_from_vec(args);
|
||||||
|
|
||||||
if flags.v8_help {
|
|
||||||
// show v8 help and exit
|
|
||||||
v8_set_flags(vec!["--help".to_string()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(ref v8_flags) = flags.v8_flags {
|
if let Some(ref v8_flags) = flags.v8_flags {
|
||||||
v8_set_flags(v8_flags.clone());
|
v8_set_flags(v8_flags.clone());
|
||||||
}
|
}
|
||||||
|
|
1
tests/v8_flags.js
Normal file
1
tests/v8_flags.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
console.log(typeof gc);
|
1
tests/v8_flags.js.out
Normal file
1
tests/v8_flags.js.out
Normal file
|
@ -0,0 +1 @@
|
||||||
|
function
|
2
tests/v8_flags.test
Normal file
2
tests/v8_flags.test
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
args: --v8-flags=--expose-gc tests/v8_flags.js
|
||||||
|
output: tests/v8_flags.js.out
|
3
tests/v8_help.out
Normal file
3
tests/v8_help.out
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[WILDCARD]
|
||||||
|
Synopsis:
|
||||||
|
[WILDCARD]d8[WILDCARD]
|
2
tests/v8_help.test
Normal file
2
tests/v8_help.test
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
args: --v8-options
|
||||||
|
output: tests/v8_help.out
|
Loading…
Add table
Reference in a new issue