Bug description
#163 turned HelpTheme into a dataclass so it could be subclassed (#159).
But a subclass that adds a slot only half works and with_(), dark() and light() fails.
To Reproduce
>>> import dataclasses
>>> from cloup import HelpTheme, Style
>>> from cloup.styling import IStyle
>>> def identity(s: str) -> str:
... return s
...
>>> @dataclasses.dataclass(frozen=True)
... class MyTheme(HelpTheme):
... metavar: IStyle = identity
...
>>> type(MyTheme.dark()).__name__
'HelpTheme'
>>> MyTheme.dark().metavar
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'HelpTheme' object has no attribute 'metavar'
>>> MyTheme().with_(metavar=Style(fg="cyan"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: HelpTheme.with_() got an unexpected keyword argument 'metavar'
Screenshots
I had to reimplement reimplements with_() in Click Extra to bypass the issue: https://github.com/kdeldycke/click-extra/blob/b4200f4b90dfdf69266cd3af77262919c3394492/click_extra/theme.py#L254-L279
Bug description
#163 turned
HelpThemeinto a dataclass so it could be subclassed (#159).But a subclass that adds a slot only half works and
with_(),dark()andlight()fails.To Reproduce
Screenshots
I had to reimplement reimplements
with_()in Click Extra to bypass the issue: https://github.com/kdeldycke/click-extra/blob/b4200f4b90dfdf69266cd3af77262919c3394492/click_extra/theme.py#L254-L279