-
-
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
Documentation: mention required=True for options #514
Comments
I think its intentional that it is not mentioned. Per the doc here
While you can have required options, the nature of an option is that it is not required. Perhaps using the default=value would be better. |
@nudies by why provide the option if it's not intended to be used? IMO it should be removed from the public API or documented. |
I don't know if this is an intended usecase, or maybe we are misusing click, but for us, all our command line parameters are options. Arguments do not provide the Please don't remove remove this functionality; we would be very sad if our use case were deprecated for purely aesthetic reasons |
I should have mentioned I'm in favour of documenting & supporting it as well, not removing it (I realize it didn't sound like that from my comment). |
Big +1 for all the reasons stated. Options are self-documenting ( |
I have also switched to using named options as named arguments. This seems to be a widely used practice. |
+1 as well. I KNEW there must be a "required" field - and this issue is where I found the documentation! |
+1 to document this - still seems be not documented. app command --search 'string'
# --search is required at this moment So I would ask for updating documentation as well. |
+1 Named in lieu of positional parameters are pretty important for us to help prevent coding errors. In our case the named parameters are not optional. |
The main reason I prefer a required |
also useful for "if option a is provided than option b is required"; otherwise b is optional. |
Honored to fix the most +1'ed issue in click history, documenting the fact that options may be required=True.
Two years later I am delighted :) Thank you! (For fixing the issue and for an awesome library I've been using for years now!) |
This is never mentioned as a possibility for
click.option
anywhere in the docs as far as I can tell (or at least it should be more prominent, maybe a section). (it talks about it in click.argument, but its unclear that it exists for both)Someone just came to me saying, "we have to stop using click, i checked everywhere in their documentation, they don't support required options, which is important!"
Thanks :)
The text was updated successfully, but these errors were encountered: