Drop the bool parameter from confirm()
confirm() now only handles the interactive prompt; callers short-circuit
the --yes path with an `if !yes` guard. Removes the awkwardly-named
boolean argument entirely.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WXTzKy6U6UByDFzfCXehbc
change
commit e7c12a41e73d4755d5968a4d27b7a70725114bea
author Claude <noreply@anthropic.com>
date
parent 8966da62
diff --git a/src/bin/ranger/commands/backlog.rs b/src/bin/ranger/commands/backlog.rs
index da0eb78..1f0a99c 100644
--- a/src/bin/ranger/commands/backlog.rs
+++ b/src/bin/ranger/commands/backlog.rs
@@ -67,17 +67,19 @@ pub async fn run(
             output::print_list(&backlogs, json, print_backlog);
         }
         BacklogCommands::Delete { name, yes } => {
-            let prompt = format!("Delete backlog '{name}' and all its tasks?");
-            match output::confirm(yes, &prompt) {
-                output::Confirm::Yes => {}
-                output::Confirm::No => {
-                    println!("Aborted.");
-                    return Ok(());
-                }
-                output::Confirm::NeedsFlag => {
-                    return Err(RangerError::Usage(format!(
-                        "refusing to delete backlog '{name}' without confirmation; pass --yes to proceed"
-                    )));
+            if !yes {
+                let prompt = format!("Delete backlog '{name}' and all its tasks?");
+                match output::confirm(&prompt) {
+                    output::Confirm::Yes => {}
+                    output::Confirm::No => {
+                        println!("Aborted.");
+                        return Ok(());
+                    }
+                    output::Confirm::NeedsFlag => {
+                        return Err(RangerError::Usage(format!(
+                            "refusing to delete backlog '{name}' without confirmation; pass --yes to proceed"
+                        )));
+                    }
                 }
             }
             let backlog = ops::backlog::delete(&mut conn, &name).await?;
diff --git a/src/bin/ranger/commands/task.rs b/src/bin/ranger/commands/task.rs
index 38a7ecb..4aca92b 100644
--- a/src/bin/ranger/commands/task.rs
+++ b/src/bin/ranger/commands/task.rs
@@ -331,18 +331,20 @@ pub async fn run(pool: &SqlitePool, command: TaskCommands, json: bool) -> Result
             let mut conn = pool.acquire().await?;
             let task = ops::task::get_by_key_prefix(&mut conn, &key, backlog_scope).await?;
 
-            let prompt = format!("Delete task '{}'?", task.title);
-            match output::confirm(yes, &prompt) {
-                output::Confirm::Yes => {}
-                output::Confirm::No => {
-                    println!("Aborted.");
-                    return Ok(());
-                }
-                output::Confirm::NeedsFlag => {
-                    return Err(Error::Usage(format!(
-                        "refusing to delete task '{}' without confirmation; pass --yes to proceed",
-                        task.title
-                    )));
+            if !yes {
+                let prompt = format!("Delete task '{}'?", task.title);
+                match output::confirm(&prompt) {
+                    output::Confirm::Yes => {}
+                    output::Confirm::No => {
+                        println!("Aborted.");
+                        return Ok(());
+                    }
+                    output::Confirm::NeedsFlag => {
+                        return Err(Error::Usage(format!(
+                            "refusing to delete task '{}' without confirmation; pass --yes to proceed",
+                            task.title
+                        )));
+                    }
                 }
             }
 
diff --git a/src/bin/ranger/output.rs b/src/bin/ranger/output.rs
index 0961d82..a961efc 100644
--- a/src/bin/ranger/output.rs
+++ b/src/bin/ranger/output.rs
@@ -63,26 +63,23 @@ pub fn print_list<T: Serialize + std::fmt::Debug>(values: &[T], json: bool, huma
     }
 }
 
-/// The outcome of a destructive-action confirmation check.
+/// The outcome of a confirmation prompt.
 pub enum Confirm {
     /// Proceed with the action.
     Yes,
     /// The user was prompted and declined.
     No,
-    /// Not pre-confirmed and not interactive — the caller should require `--yes`.
+    /// Not interactive — the caller should require `--yes`.
     NeedsFlag,
 }
 
-/// Decide whether a destructive action may proceed.
+/// Prompt on stderr to confirm a destructive action.
 ///
-/// If `assume_yes` is set, proceeds without prompting. Otherwise, prompts on
-/// stderr when stdin is a terminal; when not interactive, returns
-/// [`Confirm::NeedsFlag`] so the caller can tell the user to pass `--yes`
-/// (never blocks a script on a prompt it can't answer).
-pub fn confirm(assume_yes: bool, prompt: &str) -> Confirm {
-    if assume_yes {
-        return Confirm::Yes;
-    }
+/// Returns [`Confirm::Yes`]/[`Confirm::No`] from the user's answer when stdin is
+/// a terminal. When not interactive, returns [`Confirm::NeedsFlag`] so the caller
+/// can tell the user to pass `--yes` (never blocks a script on a prompt it can't
+/// answer). Call this only when the user has not already passed `--yes`.
+pub fn confirm(prompt: &str) -> Confirm {
     if !std::io::stdin().is_terminal() {
         return Confirm::NeedsFlag;
     }