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
|
|
@ -57,9 +57,11 @@ use crate::{cli::AddArgs, model::fork::LocalConfig};
|
|||
|
||||
pub async fn execute(
|
||||
args: AddArgs,
|
||||
global_yes: bool,
|
||||
lockfile_path: &Path,
|
||||
config_path: &Path,
|
||||
) -> Result<()> {
|
||||
let skip_prompts = global_yes;
|
||||
log::info!("Adding projects: {:?}", args.inputs);
|
||||
|
||||
// Load lockfile
|
||||
|
|
@ -187,9 +189,9 @@ pub async fn execute(
|
|||
}
|
||||
|
||||
// Prompt for confirmation unless --yes flag is set
|
||||
if !args.yes {
|
||||
if !skip_prompts {
|
||||
let prompt_msg = format!("Add project '{}'?", project.get_name());
|
||||
if !crate::ui_utils::prompt_yes_no(&prompt_msg, true)? {
|
||||
if !crate::ui_utils::prompt_yes_no(&prompt_msg, true, skip_prompts)? {
|
||||
log::info!("Skipping project: {}", project.get_name());
|
||||
continue;
|
||||
}
|
||||
|
|
@ -213,13 +215,14 @@ pub async fn execute(
|
|||
&& !all_new_projects.iter().any(|p| p.pakku_id == dep.pakku_id)
|
||||
{
|
||||
// Prompt user for confirmation unless --yes flag is set
|
||||
if !args.yes {
|
||||
if !skip_prompts {
|
||||
let prompt_msg = format!(
|
||||
"Add dependency '{}' required by '{}'?",
|
||||
dep.get_name(),
|
||||
project.get_name()
|
||||
);
|
||||
if !crate::ui_utils::prompt_yes_no(&prompt_msg, true)? {
|
||||
if !crate::ui_utils::prompt_yes_no(&prompt_msg, true, skip_prompts)?
|
||||
{
|
||||
log::info!("Skipping dependency: {}", dep.get_name());
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue