From 4bf2acb130efc1dcd3bcf163b02154b5d5b2bb98 Mon Sep 17 00:00:00 2001 From: Adrian Cederberg Date: Thu, 5 Sep 2024 11:14:47 -0600 Subject: [PATCH] fix(client): Fixed ``config use`` output error. Should close #2. No more pretty error tracebacks, they are harder to read than actual tracebacks. --- src/legere/__init__.py | 7 ++++++- src/legere/requests/base.py | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/legere/__init__.py b/src/legere/__init__.py index d9f5426..11710e8 100644 --- a/src/legere/__init__.py +++ b/src/legere/__init__.py @@ -301,7 +301,12 @@ def use( config.use.profile = profile if config_path_out is None: - context.console_handler.handle(data=config.model_dump_minimal()) + context.console_handler.handle( + handler_data=HandlerData( + data=config.model_dump_minimal(), + output_config=context.config.output, + ) + ) raise typer.Exit(0) context.console_handler.console.print("[green]Updating client config.") diff --git a/src/legere/requests/base.py b/src/legere/requests/base.py index 18bed37..5a778cb 100644 --- a/src/legere/requests/base.py +++ b/src/legere/requests/base.py @@ -312,7 +312,11 @@ def typerize( callback = ContextData.for_typer if callback is None else callback callback = callback if not exclude_callback else None - tt = typer.Typer(help=cls.typer_help or cls.__doc__) + tt = typer.Typer( + help=cls.typer_help or cls.__doc__, + pretty_exceptions_short=True, + pretty_exceptions_enable=False, + ) if not exclude_callback: assert callback is not None tt.callback()(callback)