-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
Add “maybe you meant” in argparse choices
argument
#99749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
Do you want to work on this? :) |
I don't mind working on it, I have an idea of how argparse works, it's just that I'm not a professional in git and have never done pull requests. While this is a really good idea, I'll start working on it today. |
Now completed with #124456 |
serhiy-storchaka
pushed a commit
that referenced
this issue
Oct 19, 2024
ebonnal
pushed a commit
to ebonnal/cpython
that referenced
this issue
Jan 12, 2025
ebonnal
pushed a commit
to ebonnal/cpython
that referenced
this issue
Jan 12, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Uh oh!
There was an error while loading. Please reload this page.
argparse guesses
Print the possible (nearest) value of the argument. If options are specified with the
choices
argument.Pitch
argparse are end user oriented.
Such a message will make the program interface more user-friendly.
Now outputs this:
error: argument family: invalid choice: 's200flora' (choose from 'a431', ..., 's200flor', ... 'wingdings 3')
I suggest making the output look like this:
error: argument family: invalid choice: 's200flora', maybe you meant 's200flor'? (choose from 'a431', ..., 's200flor', ... 'wingdings 3')
It doesn't have to look exactly like this. I'm not talking about the implementation, perhaps the assumptions should always be (if there are matches) in the presence of the choices argument, perhaps only in some certain conditions.
These questions are decided by those who will implement it, as they see fit.
Previous discussion
Add “maybe you meant” in argparse
choices
argument on discuss.python.orgLinked PRs
The text was updated successfully, but these errors were encountered: