Skip to content

Commit b765726

Browse files
roborourkedavidcole1340
authored andcommitted
Allow passing --yes parameter to bypass prompts
Makes this tool usable in automated builds such as Docker containers. Addresses #133
1 parent 7dac401 commit b765726

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

crates/cli/src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ struct Install {
105105
/// the directory the command is called.
106106
#[arg(long)]
107107
manifest: Option<PathBuf>,
108+
/// Whether to bypass the install prompt.
109+
#[clap(long)]
110+
yes: bool,
108111
}
109112

110113
#[derive(Parser)]
@@ -121,6 +124,9 @@ struct Remove {
121124
/// the directory the command is called.
122125
#[arg(long)]
123126
manifest: Option<PathBuf>,
127+
/// Whether to bypass the remove prompt.
128+
#[clap(long)]
129+
yes: bool,
124130
}
125131

126132
#[cfg(not(windows))]
@@ -172,7 +178,7 @@ impl Install {
172178
php_ini = Some(ini_path);
173179
}
174180

175-
if !Confirm::new()
181+
if !self.yes && !Confirm::new()
176182
.with_prompt(format!(
177183
"Are you sure you want to install the extension `{}`?",
178184
artifact.name
@@ -305,7 +311,7 @@ impl Remove {
305311
bail!("Unable to find extension installed.");
306312
}
307313

308-
if !Confirm::new()
314+
if !self.yes && !Confirm::new()
309315
.with_prompt(format!(
310316
"Are you sure you want to remove the extension `{}`?",
311317
artifact.name

0 commit comments

Comments
 (0)