From 16641eb3294d39c9dc841931a566930f735d81b1 Mon Sep 17 00:00:00 2001 From: Remi PLANEL <rplanel@pasteur.fr> Date: Thu, 23 Nov 2023 12:32:18 +0100 Subject: [PATCH] add rule for each system --- packages/df-wiki-cli/df_wiki_cli/content/main.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/df-wiki-cli/df_wiki_cli/content/main.py b/packages/df-wiki-cli/df_wiki_cli/content/main.py index b61c48ee..11113150 100644 --- a/packages/df-wiki-cli/df_wiki_cli/content/main.py +++ b/packages/df-wiki-cli/df_wiki_cli/content/main.py @@ -7,7 +7,10 @@ from pydantic_yaml import parse_yaml_raw_as, to_yaml_str import frontmatter from enum import Enum from rich.console import Console -from rich.pretty import pprint +from rich import print as rprint +from rich.layout import Layout +from rich.panel import Panel + console = Console() app = typer.Typer() @@ -53,7 +56,8 @@ def lint( ), ], ): - print(f"check system {file}") + console.rule(f"[bold blue]{file.name}", style="blue") + with open(file) as f: metadata, _ = frontmatter.parse(f.read()) # print(metadata) @@ -65,7 +69,8 @@ def lint( # print(exc.errors()) # pprint(exc.errors(), expand_all=True) for err in exc.errors(): - console.print(f"{err['msg']} : {err['type']} {','.join(err['loc'])}", style="red") - print("\n") + console.print( + f"[red]{err['msg']} : {err['type']} {' -> '.join(err['loc'])}" + ) else: - console.print("OK!\n", style="green") + console.print("[green] Everything is alright") -- GitLab