1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

Switch grant/deny prompt to yes/no (#10547)

This commit is contained in:
Ryan Dahl 2021-05-10 07:11:34 -04:00 committed by GitHub
parent dfe528198d
commit 18c75f0e42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -2902,7 +2902,7 @@ console.log("finish");
fn _061_permissions_request() {
let args = "run 061_permissions_request.ts";
let output = "061_permissions_request.ts.out";
let input = b"g\nd\n";
let input = b"y\nn\n";
util::test_pty(args, output, input);
}
@ -2912,7 +2912,7 @@ console.log("finish");
fn _062_permissions_request_global() {
let args = "run 062_permissions_request_global.ts";
let output = "062_permissions_request_global.ts.out";
let input = b"g\n";
let input = b"y\n";
util::test_pty(args, output, input);
}
@ -3077,7 +3077,7 @@ console.log("finish");
fn _090_run_permissions_request() {
let args = "run 090_run_permissions_request.ts";
let output = "090_run_permissions_request.ts.out";
let input = b"g\nd\n";
let input = b"y\nn\n";
util::test_pty(args, output, input);
}

View file

@ -1054,9 +1054,9 @@ fn permission_prompt(message: &str) -> bool {
if !atty::is(atty::Stream::Stdin) || !atty::is(atty::Stream::Stderr) {
return false;
};
let opts = "[g/d (g = grant, d = deny)] ";
let opts = "[y/n (y = yes allow, n = no deny)] ";
let msg = format!(
"{} Deno requests {}. Grant? {}",
"{} Deno requests {}. Allow? {}",
PERMISSION_EMOJI, message, opts
);
// print to stderr so that if deno is > to a file this is still displayed.
@ -1073,8 +1073,8 @@ fn permission_prompt(message: &str) -> bool {
Some(v) => v,
};
match ch.to_ascii_lowercase() {
'g' => return true,
'd' => return false,
'y' => return true,
'n' => return false,
_ => {
// If we don't get a recognized option try again.
let msg_again = format!("Unrecognized option '{}' {}", ch, opts);