Skip to content

Commit

Permalink
Allow passing --yes parameter to bypass prompts
Browse files Browse the repository at this point in the history
Makes this tool usable in automated builds such as Docker containers.

Addresses davidcole1340#133
  • Loading branch information
roborourke committed May 4, 2022
1 parent faa452e commit f0e13d3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ struct Install {
/// the directory the command is called.
#[clap(long)]
manifest: Option<PathBuf>,
/// Whether to bypass the install prompt.
#[clap(long)]
yes: bool,
}

#[derive(Parser)]
Expand All @@ -121,6 +124,9 @@ struct Remove {
/// the directory the command is called.
#[clap(long)]
manifest: Option<PathBuf>,
/// Whether to bypass the remove prompt.
#[clap(long)]
yes: bool,
}

#[cfg(not(windows))]
Expand Down Expand Up @@ -172,7 +178,7 @@ impl Install {
php_ini = Some(ini_path);
}

if !Confirm::new()
if !self.yes && !Confirm::new()
.with_prompt(format!(
"Are you sure you want to install the extension `{}`?",
artifact.name
Expand Down Expand Up @@ -301,7 +307,7 @@ impl Remove {
bail!("Unable to find extension installed.");
}

if !Confirm::new()
if !self.yes && !Confirm::new()
.with_prompt(format!(
"Are you sure you want to remove the extension `{}`?",
artifact.name
Expand Down

0 comments on commit f0e13d3

Please sign in to comment.