django-commons / django-typer

Use Typer (type hints) to define the interface for your Django management commands.
https://django-typer.rtfd.io
MIT License
88 stars 2 forks source link

How to define command-level option when using multicommand class? #133

Closed pySilver closed 1 month ago

pySilver commented 1 month ago

First of all: Thanks for such a great django wrapper for typer!

I want to add an option callback to my command class. The problem is that I have multiple commands in that class:

class Command(TyperCommand):
    @command()
    def foo(): ...

    @command
    def bar(): ...

and my option belongs to whole command (just like --version or --settings) rather than specific command. How do I do it?