Updated for dependees

This commit is contained in:
Dimitris Zlatanidis 2023-05-07 17:51:07 +03:00
parent e3549d8df0
commit b0d8aeabcb

View file

@ -41,14 +41,12 @@ class Dependees(Configs):
for pkg in self.packages:
dependees: dict = dict(self.find_requires(pkg))
package: str = f'{self.byellow}{pkg}{self.endc}'
print(package)
print(f' {self.llc}{self.hl}', end='')
print(f'{self.byellow}{pkg}{self.endc}')
print(f"{'':>1}{self.llc}{self.hl}", end='')
if not dependees:
print(f'{self.cyan} No dependees{self.endc}')
print(f"{'':>1}{self.cyan}No dependees{self.endc}")
sp: str = ' ' * 4
for n, (name, requires) in enumerate(dependees.items(), start=1):
dependency: str = f'{self.cyan}{name}{self.endc}'
@ -57,10 +55,7 @@ class Dependees(Configs):
dependency: str = (f'{self.cyan}{name}{self.endc} {self.yellow}'
f'{version}{self.endc}')
if n == 1:
print(f' {dependency}')
else:
print(f'{sp}{dependency}')
self.print_dependency(n, dependency)
if self.option_for_full_reverse:
self.print_full_reverse(n, dependees, requires)
@ -75,11 +70,18 @@ class Dependees(Configs):
return version
@staticmethod
def print_dependency(n: int, dependency: str) -> None:
if n == 1:
print(f' {dependency}')
else:
print(f"{'':>4}{dependency}")
def print_full_reverse(self, n: int, dependees: dict, requires: str) -> None:
if n == len(dependees):
print(' ' * 4 + f' {self.llc}{self.hl} {self.violet}{requires}{self.endc}')
print(f"{'':>5}{self.llc}{self.hl} {self.violet}{requires}{self.endc}")
else:
print(' ' * 4 + f' {self.var}{self.hl} {self.violet}{requires}{self.endc}')
print(f"{'':>5}{self.var}{self.hl} {self.violet}{requires}{self.endc}")
def summary_of_dependees(self, dependees: dict, pkg: str) -> None:
print(f'\n{self.grey}{len(dependees)} dependees for {pkg}{self.endc}\n')