Skip to content

Callback being executed twice when using click.option and prompt #2673

Answered by davidism
MaciekKrz asked this question in Q&A
Discussion options

You must be logged in to vote

The callback is used both to validate the prompt input, and then independently from that is used to validate the value passed to the option (which in this case came from the prompt). Usually this shouldn't matter, but if you're doing something expensive it might. You could omit the prompt from the option, and instead call prompt yourself in the command if the option wasn't given.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@MaciekKrz
Comment options

Answer selected by MaciekKrz
Comment options

You must be logged in to vote
1 reply
@yorickdowne
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants