Skip to content

Conversation

babarot
Copy link
Owner

@babarot babarot commented Feb 23, 2025

WHAT

This PR adds a new strict YES validation feature to the confirm prompt component. It enforces exact "YES" (uppercase) input and provides real-time visual feedback with colored validation indicators.

  • Strict validation that only accepts uppercase "YES"
  • Character-by-character input validation (Y->E->S sequence only)
  • Real-time visual feedback with colored indicators
    • Green checkmark (✓) for valid input
    • Red cross (✗) for invalid/incomplete input
  • Cancel operation using Ctrl+C or Esc
  • Backspace always allowed for corrections

WHY

The motivation for this change comes from two key observations:

  1. Prevention of Accidental Execution
    • Traditional Y/N prompts are too easy to confirm by muscle memory
    • Critical operations need more deliberate confirmation
    • Single-character confirmation can lead to accidental execution of dangerous operations
    • Requiring "YES" in uppercase makes users more conscious of their actions
  2. Inspired by GitHub's Repository Deletion
    • GitHub requires users to type the full repository name to confirm deletion
    • This pattern has proven effective in preventing accidental deletions
    • Similar approach for critical operations in CLI tools can provide the same safety benefits

This implementation brings that same level of safety to CLI applications, making users take a moment to consider their actions before proceeding with potentially destructive operations.

@babarot babarot merged commit 0742fe3 into main Feb 23, 2025
5 checks passed
@babarot babarot deleted the babarot/yes branch February 23, 2025 16:47
@github-actions github-actions bot mentioned this pull request Feb 23, 2025
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Mar 26, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [babarot/gomi](https://github.com/babarot/gomi) | minor | `v1.5.1` -> `v1.6.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>babarot/gomi (babarot/gomi)</summary>

### [`v1.6.0`](https://github.com/babarot/gomi/blob/HEAD/CHANGELOG.md#v160---2025-02-26)

[Compare Source](babarot/gomi@v1.5.1...v1.6.0)

##### New Features

-   Add `--prune` option for trash management by [@&#8203;babarot](https://github.com/babarot) in babarot/gomi#88
-   Implement UI-based Strict Confirmation (Following Terminal Prompt) by [@&#8203;babarot](https://github.com/babarot) in babarot/gomi#89
-   Add Image Preview in Detail View by [@&#8203;babarot](https://github.com/babarot) in babarot/gomi#92

##### Refactorings

-   Add tests  by [@&#8203;babarot](https://github.com/babarot) in babarot/gomi#86
-   Add immediate renderer instead of using immediately flag by [@&#8203;babarot](https://github.com/babarot) in babarot/gomi#87

##### Website Updates

-   Add Website Carousel and Reorganize Project Documentation by [@&#8203;babarot](https://github.com/babarot) in babarot/gomi#90
-   Tweak site designs, animations and layouts by [@&#8203;babarot](https://github.com/babarot) in babarot/gomi#91

##### Others

-   Add strict YES validation to confirm prompt by [@&#8203;babarot](https://github.com/babarot) in babarot/gomi#85

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMTMuNSIsInVwZGF0ZWRJblZlciI6IjM5LjIxMy41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
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