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
click.Choice() doesn't like integers while getting --help #784
Comments
Just hit that issue as well. Seems that most of the functions of I am workarounding the issue by using list of strings though and than calling int(foo) when working with the passed value. |
@prusnak , @fdavis are you sure that this is bug?
|
@d-ganchar Probably not a bug per se, but totally not following the Principle of least surprise. I know it's possible to create a new Choice type (example), but I think passing ints is quite common, so this might deserve a special treatment. Maybe creating a click.ChoiceInt type derived from click.Choice and with overridden methods? |
@prusnak I think that your decision makes sense |
While docstring on |
Was this issue resolved? |
We are happy to review PRs on this, but I feel that adding a click.ChoiceInt type or similar will add unnecessary complication to the API. The user is going to be inputting strings from the command line, so I think the default of specifying a choice as a list of strings makes sense. I am going to close this for now, but feel free to open if someone has an implementation or a PR. |
click.Choice() doesn't like integers while getting --help.
Given:
Gives:
The text was updated successfully, but these errors were encountered: