Closed chookie closed 2 years ago
What methods does CatchAllExceptions
override?
You could create a Python type dynamically to multi-inherit from DYMGroup
and CatchAllExceptions
(or do it statically) and use that as your click.group
class:
Dynamically:
@click.group(cls=type("MyClickGroup", (DYMGroup, CatchAllExceptions), {}))
def cli():
...
Statically:
class MyClickGroup(DYMGroup, CatchAllExceptions):
...
@click.group(cli=MyClickGroup)
def cli():
...
# with that you can also easily check the Method Resolution Order:
help(MyClickGroup)
Note: DYMGroup
overrides click.Group.resolve_command
using a mixin: https://github.com/click-contrib/click-didyoumean/blob/7485cc7212a8f28e4f160dd02ebf044d1badda67/click_didyoumean/__init__.py#L44
Thanks for the module, it's nice. How do I use this when I am using @click.group(cls=CatchAllExceptions)? I need to change the to cls=DYMGroup or use DYMCommandCollection but this voids the exception handling.