Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: prompt by default #13650

Merged
merged 2 commits into from
Feb 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions cli/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u64>,
Expand Down Expand Up @@ -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,
}
}
}
Expand Down Expand Up @@ -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"),
)
}

Expand Down Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions cli/tests/integration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,7 @@ fn js_unit_tests() {
.arg("test")
.arg("--unstable")
.arg("--location=http://js-unit-tests/foo/bar")
.arg("--no-prompt")
.arg("-A")
.arg(util::tests_path().join("unit"))
.spawn()
Expand Down
8 changes: 4 additions & 4 deletions cli/tools/installer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ fn resolve_shim_data(
executable_args.push("--cached-only".to_string());
}

if flags.prompt {
executable_args.push("--prompt".to_string());
if flags.no_prompt {
executable_args.push("--no-prompt".to_string());
}

if !flags.v8_flags.is_empty() {
Expand Down Expand Up @@ -714,7 +714,7 @@ mod tests {
fn install_prompt() {
let shim_data = resolve_shim_data(
&Flags {
prompt: true,
no_prompt: true,
..Flags::default()
},
&InstallFlags {
Expand All @@ -729,7 +729,7 @@ mod tests {

assert_eq!(
shim_data.args,
vec!["run", "--prompt", "http://localhost:4545/echo_server.ts",]
vec!["run", "--no-prompt", "http://localhost:4545/echo_server.ts",]
);
}

Expand Down
2 changes: 1 addition & 1 deletion cli/tools/standalone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ pub fn compile_to_runtime_flags(
.unsafely_ignore_certificate_errors
.clone(),
no_remote: false,
prompt: flags.prompt,
no_prompt: flags.no_prompt,
reload: false,
repl: false,
seed: flags.seed,
Expand Down