Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

can't get list of bools using multiple flag #2295

Closed
solarmist opened this issue May 26, 2022 · 0 comments
Closed

can't get list of bools using multiple flag #2295

solarmist opened this issue May 26, 2022 · 0 comments
Milestone

Comments

@solarmist
Copy link

solarmist commented May 26, 2022

I have an option that is a list of bools, but I'm pairing each boolean value with another multiple option. So I do actually need a list of booleans and not just a count of values because order matters.
I'm not using is_flag, but I assume this translates to the same under the hood.

@click.option(
    "--collection/--single",
    "-c/-s",
    type=bool,
    default=[False],
    count=True,
    help=(
        "Is a file a collection of books? Add once for every file included. "
        "Consumed in order of files."
    ),
)
@click.option(
    "--file",
    "-f",
    required=True,
    type=click.Path(
        exists=True, readable=True, dir_okay=False, allow_dash=True, path_type=str
    ),
    multiple=True,
    help=(
        "The path of the input file.  Note: Every file must be paired with a language. "
        "And the pairs will be processed left to right."
    ),
)

Environment:

Python version: 3.9.7.1
Click version: 8.1.3

Is there an alternative way I should be doing this? If not #2246 breaks my code.

@davidism davidism changed the title #2246 breaks a feature that I was using. can't get list of bools using multiple flag Jul 3, 2023
@davidism davidism added this to the 8.1.4 milestone Jul 3, 2023
@davidism davidism closed this as completed Jul 3, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 18, 2023
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants