18 from typing
import Any
25 class ClickExceptionInterceptor(click.Group):
27 def invoke(self, ctx: click.Context) -> Any:
29 return super().invoke(ctx)
30 except BaseException
as exc:
31 if isinstance(exc, KeyboardInterrupt):
34 if isinstance(exc, click.exceptions.Exit)
and exc.exit_code == 0:
37 self.handleException(ctx, exc)
39 def handleException(self, ctx: click.Context, exc: BaseException) ->
None:
40 click.echo(click.style(str(exc), fg =
"red"))
41 logging.getLogger(
"cli").debug(exc, exc_info = exc)