From f73a270715fcffbbb114c144066c9afab8ab7578 Mon Sep 17 00:00:00 2001 From: zethson Date: Sat, 3 Aug 2024 22:28:22 +0200 Subject: [PATCH] :bug: Fix Rich rendering Signed-off-by: zethson --- lamin_cli/__main__.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lamin_cli/__main__.py b/lamin_cli/__main__.py index c5eadfa..400b73b 100644 --- a/lamin_cli/__main__.py +++ b/lamin_cli/__main__.py @@ -5,6 +5,7 @@ import inspect from importlib.metadata import PackageNotFoundError, version from typing import Optional, Mapping +from functools import wraps # https://github.com/ewels/rich-click/issues/19 # Otherwise rich-click takes over the formatting. @@ -60,12 +61,18 @@ def list_commands(self, ctx: click.Context) -> Mapping[str, click.Command]: ] } - lamin_group_decorator = click.rich_config( - help_config=click.RichHelpConfiguration( - command_groups=COMMAND_GROUPS, - style_commands_table_column_width_ratio=(1, 13), + def lamin_group_decorator(f): + @click.rich_config( + help_config=click.RichHelpConfiguration( + command_groups=COMMAND_GROUPS, + style_commands_table_column_width_ratio=(1, 13), + ) ) - )(click.group()) + @click.group() + @wraps(f) + def wrapper(*args, **kwargs): + return f(*args, **kwargs) + return wrapper from click import Command, Context