mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-13 20:01:48 +01:00
Added progress bar
This commit is contained in:
parent
1dbadba9ac
commit
67c5155308
1 changed files with 16 additions and 12 deletions
|
@ -1,6 +1,8 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from progress.spinner import PixelSpinner
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.queries import SBoQueries
|
||||
|
||||
|
@ -13,27 +15,29 @@ class Dependees:
|
|||
self.flags = flags
|
||||
self.configs = Configs
|
||||
self.colors = self.configs.colour
|
||||
self.color = self.colors()
|
||||
self.bold = self.color['bold']
|
||||
self.violet = self.color['violet']
|
||||
self.cyan = self.color['cyan']
|
||||
self.grey = self.color['grey']
|
||||
self.yellow = self.color['yellow']
|
||||
self.bviolet = f'{self.bold}{self.violet}'
|
||||
self.endc = self.color['endc']
|
||||
|
||||
def slackbuilds(self):
|
||||
""" Collecting the dependees. """
|
||||
color = self.colors()
|
||||
cyan = color['cyan']
|
||||
grey = color['grey']
|
||||
yellow = color['yellow']
|
||||
endc = color['endc']
|
||||
|
||||
print(f"The list below shows the "
|
||||
f"packages that dependees on '{', '.join([p for p in self.packages])}':\n")
|
||||
|
||||
print(end='\rCollecting the data... ')
|
||||
|
||||
dependees = {}
|
||||
spinner = PixelSpinner(f'{self.endc}Collecting the data... {self.bviolet}')
|
||||
for package in self.packages:
|
||||
found = [] # Reset list every package
|
||||
sbos = SBoQueries('').sbos()
|
||||
|
||||
for sbo in sbos:
|
||||
requires = SBoQueries(sbo).requires()
|
||||
spinner.next()
|
||||
|
||||
if package in requires:
|
||||
found.append(sbo)
|
||||
|
@ -43,7 +47,7 @@ class Dependees:
|
|||
print('\n')
|
||||
if dependees:
|
||||
for key, value in dependees.items():
|
||||
print(f'{yellow}{key}{endc}')
|
||||
print(f'{self.yellow}{key}{self.endc}')
|
||||
print(end=f'\r{last}')
|
||||
char = ' ├─'
|
||||
|
||||
|
@ -52,13 +56,13 @@ class Dependees:
|
|||
char = last
|
||||
|
||||
if i == 1:
|
||||
print(f'{cyan}{v}{endc}')
|
||||
print(f'{self.cyan}{v}{self.endc}')
|
||||
else:
|
||||
print(f'{" " * 3}{cyan}{v}{endc}')
|
||||
print(f'{" " * 3}{self.cyan}{v}{self.endc}')
|
||||
|
||||
if '--full-reverse' in self.flags:
|
||||
print(f'{" " * 4}{char} {" ".join([req for req in SBoQueries(v).requires()])}')
|
||||
|
||||
print(f'\n{grey}{len(value)} dependees for {key}{endc}\n')
|
||||
print(f'\n{self.grey}{len(value)} dependees for {key}{self.endc}\n')
|
||||
else:
|
||||
print('No dependees found.\n')
|
||||
|
|
Loading…
Reference in a new issue