From de310b6517f7272a62b6743f3403b26280323574 Mon Sep 17 00:00:00 2001 From: Midgard <2885-Midgard@users.noreply.framagit.org> Date: Sun, 18 Sep 2022 04:21:12 +0200 Subject: [PATCH] Deaccentize version --- pyesearch.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pyesearch.py b/pyesearch.py index 391e77e..13f46aa 100755 --- a/pyesearch.py +++ b/pyesearch.py @@ -159,19 +159,21 @@ def longest_category_and_nameversion(infos, default_repo=None): def format_item(info, longest_cat=0, longest_namever=0, default_repo=None): - category_colour = "\x1b[0m" if info["installed"] else "\x1b[0;90m" - name_version = f"{info['name']}-{info['PV']}" + colour = "\x1b[0m" if info["installed"] else "\x1b[0;90m" + name = info['name'] name_colour = "\x1b[92m" if info["installed"] else "\x1b[36m" + version = info['PV'] repo = f"::{info['repo']}" if info["repo"] != default_repo else "" - description_colour = "\x1b[0m" if not info["installed"] else "" + + description_colour = "\x1b[0m" description = info["description"] if info["description"] else "" filler = ( - f"\x1b[{'92' if info['installed'] else '90'}m " + - ("." * (longest_namever - len(name_version) - len(repo))) + " " + + ("." * (longest_namever - len(name) - 1 - len(version) - len(repo))) ) if info["description"] else "" - return f"{category_colour}{info['category']:>{longest_cat}}/" \ - f"{name_colour}{name_version}{category_colour}{repo}{filler} " \ + return f"{colour}{info['category']:>{longest_cat}}/" \ + f"{name_colour}{name}{colour}-{version}{colour}{repo}{filler} " \ f"{description_colour}{description}"