-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Can't set the default value for multiple options with optional values #2001
Comments
Is this thing of using an option both as a flag and a non-flag common practice? I've never seen something like that in the CLIs I've used. Personally I wouldn't even allow it. |
Yeah, this doesn't seem like a feature we were intending to support. I'll probably close this, if someone wants to make a PR that makes it work consistently I'm open to it, but I don't think it needs to be an open issue. |
It's probably rather uncommon, but it is something I've run into. And I'm not using it as a flag per se: in my (somewhat strange, I admit) use case it is possible to create a label without any text, so
Well, if it isn't supported then it would be nice to get an exception when conflicting options (
I can undo all changes related to prompting in #2004 for options with multiple values, then |
We don't generally validate every single possible combination of things. There are a ton of combinations, and as a CLI application it has to be reasonably fast to create everything so it can execute when the user types the command. I'm not clear why you want to roll back #2004, but you're welcome to do that if you want, just keep in mind our license. |
I don't mean the whole PR, I've made some changes that made things weird when it came to keeping |
OK, I've made the changes that I wanted, so #2004 is good to go from my perspective. |
The following example combines optional values with multiple options:
Expected result:
('default', 'test')
Looks like when
multiple=True
, the sentinel value (click.core._flag_needs_value
) is never substituted with the default value specified byflag_value
.Environment:
The text was updated successfully, but these errors were encountered: