question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Document that default should be a tuple when used with the multiple flag

See original GitHub issue

If 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:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bporter125commented, May 7, 2019

I’ll add some notes to the options doc for this.

1reaction
jcrottscommented, May 5, 2019

Thanks for reporting the bug @NargiT, I’m going to make a new issue for this, since this issue is about a doc improvement.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found