Conversation
Codecov Report
@@ Coverage Diff @@
## master #16 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 8 8
Lines 336 336
=====================================
Hits 336 336
Continue to review full report at Codecov.
|
|
@lewoudar , It would be nice if after you review and approve this you will deploy a new version of click_params. |
|
@saroad2 to be honest, when I first saw your PR introducing |
|
Actually, the reason I didn't add The absence of choices = click.prompt(
"Enter your choices",
type=click_params.ChoiceListParamType(["a", "b", "c"]),
default="",
)If you press only Enter (meaning default will be chosen) a I think that this PR should be merged. sometimes our users want to choose a list from a subset of options, but an empty list is valid. The only constraint is that once the list has a value, it must be from a closed set of options. I my own use case one can mark a "command" with a subset of "contexts", where "contexts" are a closed set of possible values. If no contexts are chosen, the "command" is set without any "contexts", and it's a valid option. |
|
Hi @saroad2 , sorry for the very late answer, I was busy with other projects and forgot looking again for this, but it is not really an excuse.
choices = click.prompt(
"Enter your choices",
type=click_params.ChoiceListParamType(["a", "b", "c"]),
default="",
)I just test it and I don't see a bug, you will just get stuck in the prompt. Again, since BTW, testing the following code, I notice that the choices don't appear neither in the documentation, nor in the prompt, any idea why? import click
import click_params
@click.command()
@click.option('-f', '--fruit', type=click_params.ChoiceListParamType(['apple', 'pineapple']), prompt=True)
def cli(fruit):
click.echo(fruit)
fruit = click.prompt('another fruit choice', type=click_params.ChoiceListParamType(['strawberry', 'water melon']))
click.echo(fruit)
if __name__ == '__main__':
cli() |
Description
Added the
ignore_emptyparameter toChoiceParamListType