Explicitly require Y/N for Command._ask
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 344
- Forks
- 74
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 7
Description
Is your feature request related to a problem? Please describe.
Had pymanager uninstall <tag> in my terminal and in a dumb panic on my split keyboard, submitted the characters yhn:
pymanager uninstall 3.13.11
Uninstall Python 3.13.11? [Y/n] yhn
Expected to cancel/break since yhn does not match a provided option - y or n.
In actuality, it proceeded to remove that python installation.
Describe the solution you'd like
Literally match for the submitted character y or n.
Describe alternatives you've considered
Not panicking and hitting n (or hitting anything else really, as long as it does not start with y)
Additional context
Was a silly mistake that costed me enough rebuild time that I came back just to figure out why it happened.
https://github.com/python/pymanager/blob/main/src/manage/commands.py#L624
Since we match via startswith, it does not matter what the remaining characters are - as long as expect_char is the first char, then _ask evaluates.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at src/manage/commands.py around lines 610-624, especially the Command._ask entry point and the linked prompt logic. Verify that an input such as yhn is rejected rather than treated as y, while the intended Y/N responses retain their expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100