From a5d204d425c69809b82309325ac65113fb876b54 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sat, 12 Feb 2022 22:13:21 -0500 Subject: feat: permission prompt by default (#13650) --- cli/flags.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'cli/flags.rs') diff --git a/cli/flags.rs b/cli/flags.rs index 7255502fe..cdf6a9ec9 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -245,7 +245,7 @@ pub struct Flags { /// If true, a list of Node built-in modules will be injected into /// the import map. pub compat: bool, - pub prompt: bool, + pub no_prompt: bool, pub reload: bool, pub repl: bool, pub seed: Option, @@ -394,7 +394,7 @@ impl Flags { allow_read: self.allow_read.clone(), allow_run: self.allow_run.clone(), allow_write: self.allow_write.clone(), - prompt: self.prompt, + prompt: !self.no_prompt, } } } @@ -1489,10 +1489,13 @@ fn permission_args(app: App) -> App { .long("allow-all") .help("Allow all permissions"), ) + .arg(Arg::new("prompt").long("prompt").help( + "deprecated: Fallback to prompt if required permission wasn't passed", + )) .arg( - Arg::new("prompt") - .long("prompt") - .help("Fallback to prompt if required permission wasn't passed"), + Arg::new("no-prompt") + .long("no-prompt") + .help("Always throw if required permission wasn't passed"), ) } @@ -2287,8 +2290,8 @@ fn permission_args_parse(flags: &mut Flags, matches: &clap::ArgMatches) { flags.allow_ffi = Some(vec![]); flags.allow_hrtime = true; } - if matches.is_present("prompt") { - flags.prompt = true; + if matches.is_present("no-prompt") { + flags.no_prompt = true; } } fn unsafely_ignore_certificate_errors_parse( -- cgit v1.2.3