Explicitly require Y/N for Command._ask
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 344
- 派生
- 74
- 平均合并
- 1 天 3 小时
- 30 天内合并 PR
- 7
描述
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.
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 src/manage/commands.py 的第 610-624 行附近开始,重点查看入口点 Command._ask 和相关的 prompt 逻辑。验证诸如 yhn 这样的输入会被拒绝,而不是被当作 y 处理,同时预期的 Y/N 响应仍保持其预期行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 55/100