couling / dataclass-click

Wrapper for pallets/click that uses dataclasses instead of kwargs
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

Introspection for dataclasses with inheritance #6

Closed couling closed 5 months ago

couling commented 5 months ago

Fixed bug where inheritance of dataclasses was not properly explored.

This should now work as expected:

    @dataclass()
    class Parent:
        foo: Annotated[int | None, option()]

    @dataclass
    class Config(Parent):
        bar: Annotated[int | None, option()]

    @click.command()
    @dataclass_click(Config)
    def main(*args, **kwargs):
        results.append((args, kwargs))