From ff5619de6bc67d31e819662f8adbb21c89749dcb Mon Sep 17 00:00:00 2001 From: Remi PLANEL <rplanel@pasteur.fr> Date: Thu, 23 Nov 2023 10:49:53 +0100 Subject: [PATCH] add color --- packages/df-wiki-cli/df_wiki_cli/content/main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 d6a303c1..b61c48ee 100644 --- a/packages/df-wiki-cli/df_wiki_cli/content/main.py +++ b/packages/df-wiki-cli/df_wiki_cli/content/main.py @@ -6,7 +6,10 @@ from pydantic import BaseModel, ValidationError 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 +console = Console() app = typer.Typer() @@ -60,8 +63,9 @@ def lint( # print(repr(exc.errors()[0]["type"])) # print(repr(exc)) # print(exc.errors()) + # pprint(exc.errors(), expand_all=True) for err in exc.errors(): - print(f"{err['msg']} : {err['type']} {err['loc']}") + console.print(f"{err['msg']} : {err['type']} {','.join(err['loc'])}", style="red") print("\n") else: - print("OK!\n") + console.print("OK!\n", style="green") -- GitLab