Add --yes flag to skip interactive confirmation

Needed for non-TTY contexts where the prompt defaults to N.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Erich Blume 2026-02-22 15:29:00 -08:00
commit 85b3d92fbf

View file

@ -5,6 +5,7 @@
# ///
#MISE description="Delete branches that have been merged into main (local and remote)"
#USAGE flag "--dry-run" help="Show what would be deleted without deleting"
#USAGE flag "--yes" help="Skip confirmation prompt"
#USAGE flag "--local-only" help="Only clean up local branches"
#USAGE flag "--remote-only" help="Only clean up remote branches"
#USAGE flag "--cutoff <cutoff>" default="30" help="Only delete branches whose HEAD commit is older than N days (default 30)"
@ -115,6 +116,10 @@ def main(
bool,
typer.Option("--dry-run", help="Show what would be deleted without deleting"),
] = False,
yes: Annotated[
bool,
typer.Option("--yes", "-y", help="Skip confirmation prompt"),
] = False,
local_only: Annotated[
bool,
typer.Option("--local-only", help="Only clean up local branches"),
@ -211,7 +216,7 @@ def main(
raise typer.Exit(0)
# Confirm
if not typer.confirm("\nProceed with deletion?"):
if not yes and not typer.confirm("\nProceed with deletion?"):
console.print("[dim]Aborted.[/dim]")
raise typer.Exit(0)