Skip to content
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

Why does Click pass None for unset options? #627

Closed
simonvanderveldt opened this issue Aug 5, 2016 · 2 comments
Closed

Why does Click pass None for unset options? #627

simonvanderveldt opened this issue Aug 5, 2016 · 2 comments

Comments

@simonvanderveldt
Copy link

This seems like the same issue/an extension of #588

I'm making a CLI around an existing module which already has some defaults in it's arguments.
I didn't expect it but Click apparently always passes None for options if they are not set, instead of not passing them at all which is what I expected.

How can I best do this? Checking if an option == None doesn't really sound good.
Is there anything that can be done to enhance this?

@untitaker
Copy link
Contributor

Not really, as I haven't noticed anybody else complaining about this sort of behavior I'd say there's no need for Click to change.

I wouldn't map an existing internal API 1:1 anyway and always create a wrapper function. Otherwise you can't set proper help output, for example.

@ghost
Copy link

ghost commented Sep 26, 2016

this is kind of annoying when trying to migrate beets to click with our optparse compatibility layer. We were hoping not to have to change any of the internals, but we might have to now :(

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants