|
33 | 33 | try: |
34 | 34 | import rich |
35 | 35 |
|
36 | | - from . import rich_utils |
37 | | - |
38 | 36 | DEFAULT_MARKUP_MODE: MarkupMode = "rich" |
39 | 37 |
|
40 | 38 | except ImportError: # pragma: no cover |
@@ -213,6 +211,8 @@ def _main( |
213 | 211 | raise |
214 | 212 | # Typer override |
215 | 213 | if rich and rich_markup_mode is not None: |
| 214 | + from . import rich_utils |
| 215 | + |
216 | 216 | rich_utils.rich_format_error(e) |
217 | 217 | else: |
218 | 218 | e.show() |
@@ -243,6 +243,8 @@ def _main( |
243 | 243 | raise |
244 | 244 | # Typer override |
245 | 245 | if rich and rich_markup_mode is not None: |
| 246 | + from . import rich_utils |
| 247 | + |
246 | 248 | rich_utils.rich_abort_error() |
247 | 249 | else: |
248 | 250 | click.echo(_("Aborted!"), file=sys.stderr) |
@@ -705,6 +707,8 @@ def main( |
705 | 707 | def format_help(self, ctx: click.Context, formatter: click.HelpFormatter) -> None: |
706 | 708 | if not rich or self.rich_markup_mode is None: |
707 | 709 | return super().format_help(ctx, formatter) |
| 710 | + from . import rich_utils |
| 711 | + |
708 | 712 | return rich_utils.rich_format_help( |
709 | 713 | obj=self, |
710 | 714 | ctx=ctx, |
@@ -768,6 +772,8 @@ def main( |
768 | 772 | def format_help(self, ctx: click.Context, formatter: click.HelpFormatter) -> None: |
769 | 773 | if not rich or self.rich_markup_mode is None: |
770 | 774 | return super().format_help(ctx, formatter) |
| 775 | + from . import rich_utils |
| 776 | + |
771 | 777 | return rich_utils.rich_format_help( |
772 | 778 | obj=self, |
773 | 779 | ctx=ctx, |
|
0 commit comments