Deaccentize version
This commit is contained in:
parent
903ae85abc
commit
de310b6517
1 changed files with 9 additions and 7 deletions
16
pyesearch.py
16
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):
|
def format_item(info, longest_cat=0, longest_namever=0, default_repo=None):
|
||||||
category_colour = "\x1b[0m" if info["installed"] else "\x1b[0;90m"
|
colour = "\x1b[0m" if info["installed"] else "\x1b[0;90m"
|
||||||
name_version = f"{info['name']}-{info['PV']}"
|
name = info['name']
|
||||||
name_colour = "\x1b[92m" if info["installed"] else "\x1b[36m"
|
name_colour = "\x1b[92m" if info["installed"] else "\x1b[36m"
|
||||||
|
version = info['PV']
|
||||||
repo = f"::{info['repo']}" if info["repo"] != default_repo else ""
|
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 ""
|
description = info["description"] if info["description"] else ""
|
||||||
|
|
||||||
filler = (
|
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 ""
|
) if info["description"] else ""
|
||||||
return f"{category_colour}{info['category']:>{longest_cat}}/" \
|
return f"{colour}{info['category']:>{longest_cat}}/" \
|
||||||
f"{name_colour}{name_version}{category_colour}{repo}{filler} " \
|
f"{name_colour}{name}{colour}-{version}{colour}{repo}{filler} " \
|
||||||
f"{description_colour}{description}"
|
f"{description_colour}{description}"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue