[Python] How to reuse options from groups to command in Python Click?

Discussão em 'Python' iniciado por Stack, Junho 16, 2025.

  1. Stack

    Stack Membro Participativo

    I have the following:

    @click.option("--option1")
    @click.option("--option2")
    @click.option("--option3")
    @click.group()
    def group(option1, option2, option3):
    pass

    @click.option("--option1")
    @click.option("--option2")
    @click.option("--option3")
    @group.command()
    def cli(option1, option2, option3):
    # do something with args
    ...


    Is there a way to reuse options between the group and the command?

    Continue reading...

Compartilhe esta Página