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
|
|
@ -14,9 +14,12 @@ use crate::{
|
|||
|
||||
pub async fn execute(
|
||||
args: InitArgs,
|
||||
global_yes: bool,
|
||||
lockfile_path: &Path,
|
||||
config_path: &Path,
|
||||
) -> Result<(), PakkerError> {
|
||||
let skip_prompts = global_yes;
|
||||
|
||||
if lockfile_path.exists() {
|
||||
return Err(PakkerError::AlreadyExists(
|
||||
"Lock file already exists".into(),
|
||||
|
|
@ -24,7 +27,7 @@ pub async fn execute(
|
|||
}
|
||||
|
||||
// Interactive mode: prompt for values not provided via CLI and --yes not set
|
||||
let is_interactive = !args.yes && args.name.is_none();
|
||||
let is_interactive = !skip_prompts && args.name.is_none();
|
||||
|
||||
// Get modpack name
|
||||
let name = if let Some(name) = args.name.clone() {
|
||||
|
|
@ -137,6 +140,7 @@ pub async fn execute(
|
|||
projects: None,
|
||||
export_profiles: None,
|
||||
export_server_side_projects_to_client: None,
|
||||
file_count_preference: None,
|
||||
};
|
||||
|
||||
let config_dir = config_path.parent().unwrap_or(Path::new("."));
|
||||
|
|
@ -164,9 +168,13 @@ pub async fn execute(
|
|||
|
||||
if !has_cf_key {
|
||||
println!();
|
||||
if prompt_yes_no("Would you like to set up CurseForge API key now?", true)
|
||||
.map_err(|e| PakkerError::InvalidInput(e.to_string()))?
|
||||
&& let Ok(Some(api_key)) = prompt_curseforge_api_key()
|
||||
if prompt_yes_no(
|
||||
"Would you like to set up CurseForge API key now?",
|
||||
true,
|
||||
skip_prompts,
|
||||
)
|
||||
.map_err(|e| PakkerError::InvalidInput(e.to_string()))?
|
||||
&& let Ok(Some(api_key)) = prompt_curseforge_api_key(skip_prompts)
|
||||
{
|
||||
// Save to credentials file
|
||||
let creds_path = std::env::var("HOME").map_or_else(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue