Fixed package and version alignment

This commit is contained in:
Dimitris Zlatanidis 2023-05-25 17:25:45 +03:00
parent 137b6c6d46
commit 5bde928311

View file

@ -90,10 +90,11 @@ class AsciiBox(Configs):
f"{self.bd_color}{self.vertical_line}{self.endc}")
def draw_package_line(self, package: str, version: str, size: str, color: str, repo: str) -> None:
if len(version) >= 20 and self.columns <= 80:
if len(version) >= (self.version_alignment - 5):
version: str = f'{version[:self.version_alignment - 5]}...'
if len(package) >= 15 and self.columns <= 80:
package: str = f'{package[:self.package_alignment - 5]}...'
if len(package) >= (self.package_alignment - 4):
package: str = f'{package[:self.package_alignment - 4]}...'
print(f"{self.bd_color}{self.vertical_line} {self.bold}{color}{package:<{self.package_alignment}}{self.endc}"
f"{self.bd_color}{version:<{self.version_alignment}}{self.endc}{size:<{self.size_alignment}}{self.blue}"
f"{repo:>{self.repo_alignment}}{self.bd_color} {self.vertical_line}{self.endc}")