Skip to content

feat(ui): print explicit abort message on non-yes confirmation input - #17

Merged
jmelosegui merged 1 commit into
mainfrom
feat/confirm-explicit-abort
Apr 27, 2026
Merged

feat(ui): print explicit abort message on non-yes confirmation input#17
jmelosegui merged 1 commit into
mainfrom
feat/confirm-explicit-abort

Conversation

@jmelosegui

Copy link
Copy Markdown
Owner

Summary

Today the confirm prompt accepts `y` / `yes` (case-insensitive) and silently treats anything else -- including typos like `yse` or `asdf` -- as a decline. The user sees no acknowledgement; the program just exits without deleting.

This change keeps the safe-by-default semantics (anything that is not yes is still a decline) but prints `not a yes -- aborting.` whenever the input is not affirmative, so the user knows their input was understood:

```
Proceed with deleting 1 branch(es)? [y/N]: asdf
not a yes -- aborting.
```

The yes-detection logic is extracted into a small `interpretConfirm` helper so it can be unit-tested without faking stdin.

Test plan

  • `go test ./...` (new `TestInterpretConfirm` covers y/Y/yes/YES, leading/trailing space, empty Enter, EOF, n/no, typos).
  • Manual: in a repo with deletable branches, run `git-sweep`, type `asdf` at the prompt; expect `not a yes -- aborting.` and no deletions.
  • Manual: same flow with `y`; expect deletion to proceed.
  • Manual: same flow with plain Enter; expect the abort message and no deletions.

Previously any input other than y/yes was silently treated as a
decline. A user who typoed (e.g. 'yse', 'asdf') saw the prompt
disappear with no deletion and no acknowledgement. Now any non-yes
answer prints 'not a yes -- aborting.' before returning, so the user
knows the input was understood as a decline rather than dropped.

Empty Enter still counts as the [y/N] default decline and now also
gets the message; the goal is no silent dismissal.

Extracts a small interpretConfirm helper so the yes-detection logic
can be tested without faking stdin.
@jmelosegui
jmelosegui merged commit f71cdcc into main Apr 27, 2026
6 checks passed
@jmelosegui
jmelosegui deleted the feat/confirm-explicit-abort branch April 27, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant