Skip to content

Defining option groups without decorators #19

Description

@Tenchi2xh

Hi!

In my current project, I have my own subclass of click.Command where I pre-initialise a bunch of options in self.params.

class MyCommand(click.Command):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.params = [
            click.Option(("-a", "--A"), ...),
            click.Option(("-b", "--B"), ...),
            click.Option(("-c", "--C"), ...),
        ] + self.params

This list takes param objects and I was wondering if it's possible to instantiate an option group in this fashion without using the decorators? Have been peeking at the source here but wasn't able to find a way

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions