From 55ae9fb797c2b4c4ea19c46a975bf76d6dbc3e34 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Mon, 17 Feb 2025 16:01:56 +0100 Subject: [PATCH] fix(step/nix-helper): Add support for --yes --- src/steps/os/unix.rs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/steps/os/unix.rs b/src/steps/os/unix.rs index 9da1f216..d78d1cc4 100644 --- a/src/steps/os/unix.rs +++ b/src/steps/os/unix.rs @@ -677,7 +677,14 @@ pub fn run_nix_helper(ctx: &ExecutionContext) -> Result<()> { if nixos_cfg.is_ok_and(|x| x.contains(&format!(r#""{hostname}""#))) { print_separator("nh os"); - run_type.execute(&nix_helper).arg("os").arg("switch").status_checked()?; + let mut cmd = run_type.execute(&nix_helper); + cmd.arg("os"); + cmd.arg("switch"); + + if !ctx.config().yes(Step::NixHelper) { + cmd.arg("--ask"); + } + cmd.status_checked()?; } if let Ok(home_cfg) = home_cfg { @@ -685,11 +692,14 @@ pub fn run_nix_helper(ctx: &ExecutionContext) -> Result<()> { if home_cfg.contains(&format!(r#""{username}""#)) || home_cfg.contains(&username_at_hostname) { print_separator("nh home"); - run_type - .execute(&nix_helper) - .arg("home") - .arg("switch") - .status_checked()?; + let mut cmd = run_type.execute(&nix_helper); + cmd.arg("home"); + cmd.arg("switch"); + + if !ctx.config().yes(Step::NixHelper) { + cmd.arg("--ask"); + } + cmd.status_checked()?; } }