-
-
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
Optional arguments #94
Comments
Yes. Set required to false. |
Just saw the If anyone else stumbles across this, as a quick ref, it's a simple as...
|
JFTR: if nargs is -1 then the argument becomes implicitly "non required". An empty sequence still works. |
I think the documentation could make this flag more obvious, by putting a section on the Arguments page. |
I landed here looking for a way of specifying multiple optional arguments. Based on the examples above, I did: @click.command()
@click.argument('size', required=False)
@click.argument('flavour', required=False)
def order_pizza(size, flavour):
print "Ordering {} ({})".format(size, flavour) This gives you two positional arguments, both of which are optional. |
This helped me today. :) |
Are optional arguments currently possible with click?
For example...
The text was updated successfully, but these errors were encountered: