cli/commands: update all commands to use global_yes parameter
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I4d95a425f2bed75aed1b5233adf1a3646a6a6964
This commit is contained in:
parent
a89184a358
commit
f2af2fbbe4
6 changed files with 39 additions and 17 deletions
|
|
@ -9,9 +9,11 @@ use crate::{
|
|||
|
||||
pub async fn execute(
|
||||
args: RmArgs,
|
||||
global_yes: bool,
|
||||
lockfile_path: &Path,
|
||||
_config_path: &Path,
|
||||
) -> Result<()> {
|
||||
let skip_prompts = global_yes;
|
||||
// Load expects directory path, so get parent directory
|
||||
let lockfile_dir = lockfile_path.parent().unwrap_or(Path::new("."));
|
||||
let mut lockfile = LockFile::load(lockfile_dir)?;
|
||||
|
|
@ -79,7 +81,9 @@ pub async fn execute(
|
|||
resolved_inputs.push(input.clone());
|
||||
} else if !args.all {
|
||||
// Try typo suggestion
|
||||
if let Ok(Some(suggestion)) = prompt_typo_suggestion(input, &all_slugs) {
|
||||
if let Ok(Some(suggestion)) =
|
||||
prompt_typo_suggestion(input, &all_slugs, skip_prompts)
|
||||
{
|
||||
log::info!("Using suggested project: {suggestion}");
|
||||
resolved_inputs.push(suggestion);
|
||||
} else {
|
||||
|
|
@ -111,13 +115,13 @@ pub async fn execute(
|
|||
|
||||
// Ask for confirmation unless --yes flag is provided or --all with no
|
||||
// projects
|
||||
if !args.yes {
|
||||
if !skip_prompts {
|
||||
println!("The following projects will be removed:");
|
||||
for name in &projects_to_remove {
|
||||
println!(" - {name}");
|
||||
}
|
||||
|
||||
if !prompt_yes_no("Do you want to continue?", false)? {
|
||||
if !prompt_yes_no("Do you want to continue?", false, skip_prompts)? {
|
||||
println!("Removal cancelled.");
|
||||
return Ok(());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue