|

cli: cmd_remove prompts for confirmation; --yes skips the prompt (was: --yes required)

Author: Chris Tusa <chris.tusa@leafscale.com>
Date: May 09, 2026 18:37
Node: 9164d6703c1a6007e0a8ac5a33fb8c7d075324bd
Branch: default

Changed files:

Diff

diff -r ca19acca6bfe -r 9164d6703c1a src/cli.reef
--- a/src/cli.reef	Sat May 09 13:30:10 2026 -0500
+++ b/src/cli.reef	Sat May 09 18:37:55 2026 -0500
@@ -600,7 +600,7 @@
     let parser: flag.FlagParser = flag.flag_parser_from(argv)
     flag.application(parser, "repoman remove")
     flag.description(parser, "Remove a project: delete its container and registry entry")
-    let _y   = flag.bool_flag(parser, "yes", 'y', false, "confirm removal (required)")
+    let _y   = flag.bool_flag(parser, "yes", 'y', false, "skip the confirmation prompt")
     let _k   = flag.bool_flag(parser, "keep-incus", '\0', false, "leave the incus container; only remove from registry")
 
     if not flag.parse(parser)
@@ -614,15 +614,19 @@
         return 2
     end if
 
-    let confirmed: bool = flag.get_bool(parser, "yes")
-    if not confirmed
-        console.printErr("repoman: error: 'remove' requires --yes (or -y) to confirm")
-        return 2
-    end if
-
     let name: string = positionals[0]
     let keep_incus: bool = flag.get_bool(parser, "keep-incus")
 
+    // Confirmation: --yes skips the prompt; otherwise ask the user (defaults to no).
+    let auto_confirmed: bool = flag.get_bool(parser, "yes")
+    if not auto_confirmed
+        let proceed: bool = console.confirm_default_no("remove project '" + name + "'? this is destructive")
+        if not proceed
+            println("aborted")
+            return 4
+        end if
+    end if
+
     let home: string = env.get_env_or("HOME", "")
     if str.length(home) == 0
         console.printErr("repoman: error: HOME is not set")
@@ -951,8 +955,8 @@
     console.printErr("  status [name]")
     console.printErr("      Show project state from registry + live incus query.")
     console.printErr("")
-    console.printErr("  remove <name> --yes [--keep-incus]")
-    console.printErr("      Delete the incus container and registry entry. --yes required.")
+    console.printErr("  remove <name> [--yes | -y] [--keep-incus]")
+    console.printErr("      Delete the incus container and registry entry. Prompts for confirmation unless --yes.")
     console.printErr("")
     console.printErr("  shell <name> [--cwd <path>]")
     console.printErr("      Open a bash login shell inside the project's container.")