summaryrefslogtreecommitdiff
path: root/cli/flags.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/flags.rs')
-rw-r--r--cli/flags.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/flags.rs b/cli/flags.rs
index e5d3a6493..bdd97eea4 100644
--- a/cli/flags.rs
+++ b/cli/flags.rs
@@ -214,6 +214,7 @@ pub struct Flags {
pub argv: Vec<String>,
pub subcommand: DenoSubcommand,
+ pub allow_all: bool,
pub allow_env: Option<Vec<String>>,
pub allow_hrtime: bool,
pub allow_net: Option<Vec<String>>,
@@ -269,6 +270,11 @@ impl Flags {
pub fn to_permission_args(&self) -> Vec<String> {
let mut args = vec![];
+ if self.allow_all {
+ args.push("--allow-all".to_string());
+ return args;
+ }
+
match &self.allow_read {
Some(read_allowlist) if read_allowlist.is_empty() => {
args.push("--allow-read".to_string());
@@ -2252,6 +2258,7 @@ fn permission_args_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
flags.allow_hrtime = true;
}
if matches.is_present("allow-all") {
+ flags.allow_all = true;
flags.allow_read = Some(vec![]);
flags.allow_env = Some(vec![]);
flags.allow_net = Some(vec![]);
@@ -2647,6 +2654,7 @@ mod tests {
subcommand: DenoSubcommand::Run(RunFlags {
script: "gist.ts".to_string(),
}),
+ allow_all: true,
allow_net: Some(vec![]),
allow_env: Some(vec![]),
allow_run: Some(vec![]),