Document that default should be a tuple when used with the multiple flag
See original GitHub issueIf a choice option also allows multiple values, the default value is split into single chars and no longer matches one of the choices.
The desired behavior is to specify multiple format options and have each one of them validated against the choice options available. The default value can be one of the choice options.
choice option allows multiple values, with a default
@click.option('--format',
default='one',
multiple=True,
show_default=True,
type=click.Choice(["one", "two"]),
error
Error: Invalid value for "--format": invalid choice: o. (choose from one, two)
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Options — Click Documentation (8.1.x)
When passing a default with multiple=True , the default value must be a list or tuple, otherwise it will be interpreted as a...
Read more >typing — Support for type hints — Python 3.11.1 documentation
Source code: Lib/typing.py This module provides runtime support for type hints. The most fundamental support consists of the types Any, Union, Callable, ...
Read more >Using more than one flag in python re.findall - Stack Overflow
You can't put the flags within a tuple. Use the pipe character (OR operand) within your flags ...
Read more >Flags - Abseil
You then specify your file with the special flag --flagfile=somefile . You can recursively nest flagfile= tokens or use multiple files on the...
Read more >SiLK — rwfilter - CERT NetSA Security Suite
To read files from the data store, use the following options to specify which ... Some flow generators, such as yaf(1), can export...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ll add some notes to the options doc for this.
Thanks for reporting the bug @NargiT, I’m going to make a new issue for this, since this issue is about a doc improvement.