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:
raf 2026-02-28 23:40:42 +03:00
commit f2af2fbbe4
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
6 changed files with 39 additions and 17 deletions

View file

@ -9,9 +9,11 @@ use crate::{
pub async fn execute(
args: ImportArgs,
global_yes: bool,
lockfile_path: &Path,
config_path: &Path,
) -> Result<()> {
let skip_prompts = global_yes;
log::info!("Importing modpack from {}", args.file);
log::info!(
"Dependency resolution: {}",
@ -27,7 +29,7 @@ pub async fn execute(
}
// Check if lockfile or config already exist
if (lockfile_path.exists() || config_path.exists()) && !args.yes {
if (lockfile_path.exists() || config_path.exists()) && !skip_prompts {
let msg = if lockfile_path.exists() && config_path.exists() {
"Both pakku-lock.json and pakku.json exist. Importing will overwrite \
them. Continue?"
@ -37,7 +39,7 @@ pub async fn execute(
"pakku.json exists. Importing will overwrite it. Continue?"
};
if !prompt_yes_no(msg, false)? {
if !prompt_yes_no(msg, false, skip_prompts)? {
log::info!("Import cancelled by user");
return Ok(());
}
@ -146,6 +148,7 @@ async fn import_modrinth(
if let Err(e) = project.select_file(
&lockfile.mc_versions,
std::slice::from_ref(&loader.0),
None, // Use default (1 file) during import
) {
log::warn!(
"Failed to select file for {}: {}",
@ -185,6 +188,7 @@ async fn import_modrinth(
projects: None,
export_profiles: None,
export_server_side_projects_to_client: None,
file_count_preference: None,
};
// Save files using provided paths
@ -314,6 +318,7 @@ async fn import_curseforge(
if let Err(e) = project.select_file(
&lockfile.mc_versions,
&loaders.keys().cloned().collect::<Vec<_>>(),
None, // Use default (1 file) during import
) {
log::warn!(
"Failed to select file for {}: {}",
@ -328,6 +333,7 @@ async fn import_curseforge(
if let Err(e) = project.select_file(
&lockfile.mc_versions,
&loaders.keys().cloned().collect::<Vec<_>>(),
None, // Use default (1 file) during import
) {
log::warn!(
"Failed to select file for {}: {}",
@ -368,6 +374,7 @@ async fn import_curseforge(
projects: None,
export_profiles: None,
export_server_side_projects_to_client: None,
file_count_preference: None,
};
// Save files using provided paths