From 4b705b88bf46fdecf317e14422c01fbe9f2c6c43 Mon Sep 17 00:00:00 2001 From: mashehu Date: Thu, 24 Oct 2024 11:11:31 +0200 Subject: [PATCH] `modules update`: add a panel around diffs --- nf_core/modules/modules_differ.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nf_core/modules/modules_differ.py b/nf_core/modules/modules_differ.py index f9ba9d30c..4616e27d9 100644 --- a/nf_core/modules/modules_differ.py +++ b/nf_core/modules/modules_differ.py @@ -7,6 +7,7 @@ from typing import Dict, List, Union from rich.console import Console +from rich.panel import Panel from rich.syntax import Syntax import nf_core.utils @@ -293,7 +294,8 @@ def print_diff( # The file has changed log.info(f"Changes in '{Path(module, file)}':") # Pretty print the diff using the pygments diff lexer - console.print(Syntax("".join(diff), "diff", theme="ansi_dark", padding=1)) + syntax = Syntax("".join(diff), "diff", theme="ansi_dark", line_numbers=True) + console.print(Panel(syntax, title=str(file), title_align="left", padding=0)) @staticmethod def per_file_patch(patch_fn: Union[str, Path]) -> Dict[str, List[str]]: