Deaccentize version

This commit is contained in:
Midgard 2022-09-18 04:21:12 +02:00
parent 903ae85abc
commit de310b6517
Signed by untrusted user who does not match committer: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -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}"