summaryrefslogtreecommitdiff
path: root/cli/flags.rs
diff options
context:
space:
mode:
authorcrowlKats <13135287+crowlKats@users.noreply.github.com>2021-04-12 04:15:43 +0200
committerGitHub <noreply@github.com>2021-04-12 11:15:43 +0900
commitfefe93c91b63e35bf88f5f432f0cca09948d0623 (patch)
treebf8f3e031cf558161277e01e4ca2e2c7817ef6ab /cli/flags.rs
parent8b49d948f58e0665e87e63f7e154ab53fa60a939 (diff)
feat(runtime/permissions): prompt fallback (#9376)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com> Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli/flags.rs')
-rw-r--r--cli/flags.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/cli/flags.rs b/cli/flags.rs
index eb4bc8641..5feb46371 100644
--- a/cli/flags.rs
+++ b/cli/flags.rs
@@ -149,7 +149,7 @@ pub struct Flags {
pub lock_write: bool,
pub log_level: Option<Level>,
pub no_check: bool,
- pub no_prompts: bool,
+ pub prompt: bool,
pub no_remote: bool,
pub reload: bool,
pub repl: bool,
@@ -244,6 +244,7 @@ impl From<Flags> for PermissionsOptions {
allow_read: flags.allow_read,
allow_run: flags.allow_run,
allow_write: flags.allow_write,
+ prompt: flags.prompt,
}
}
}
@@ -1428,6 +1429,11 @@ fn permission_args<'a, 'b>(app: App<'a, 'b>) -> App<'a, 'b> {
.long("allow-all")
.help("Allow all permissions"),
)
+ .arg(
+ Arg::with_name("prompt")
+ .long("prompt")
+ .help("Fallback to prompt if required permission wasn't passed"),
+ )
}
fn run_subcommand<'a, 'b>() -> App<'a, 'b> {
@@ -1844,6 +1850,9 @@ fn permission_args_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
flags.allow_plugin = true;
flags.allow_hrtime = true;
}
+ if matches.is_present("prompt") {
+ flags.prompt = true;
+ }
}
// TODO(ry) move this to utility module and add test.