From bf9b0c8231d59bfcc79e55b6cde861b68975d5b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 3 May 2019 14:59:52 +0200 Subject: Fix: deno --v8-options does not print v8 options (#2277) --- cli/flags.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'cli/flags.rs') diff --git a/cli/flags.rs b/cli/flags.rs index b5a3afdab..d66c9528c 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -2,7 +2,6 @@ use clap::{App, AppSettings, Arg, ArgMatches, SubCommand}; // Creates vector of strings, Vec -#[cfg(test)] macro_rules! svec { ($($x:expr),*) => (vec![$($x.to_string()),*]); } @@ -23,7 +22,6 @@ pub struct DenoFlags { pub allow_run: bool, pub allow_high_precision: bool, pub no_prompts: bool, - pub v8_help: bool, pub v8_flags: Option>, } @@ -245,15 +243,17 @@ pub fn parse_flags(matches: ArgMatches) -> DenoFlags { flags.no_prompts = true; } 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") { - let v8_flags: Vec = matches + let mut v8_flags: Vec = matches .values_of("v8-flags") .unwrap() .map(String::from) .collect(); + v8_flags.insert(0, "deno".to_string()); flags.v8_flags = Some(v8_flags); } @@ -408,7 +408,7 @@ mod tests { assert_eq!( flags, DenoFlags { - v8_help: true, + v8_flags: Some(svec!["deno", "--help"]), ..DenoFlags::default() } ); @@ -420,7 +420,7 @@ mod tests { assert_eq!( flags, DenoFlags { - v8_flags: Some(svec!["--expose-gc", "--gc-stats=1"]), + v8_flags: Some(svec!["deno", "--expose-gc", "--gc-stats=1"]), ..DenoFlags::default() } ); -- cgit v1.2.3