mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-13 20:01:48 +01:00
Updated views
This commit is contained in:
parent
cae5cb3d66
commit
b48b33ce79
1 changed files with 28 additions and 5 deletions
|
@ -17,28 +17,37 @@ class ViewMessage:
|
|||
|
||||
for sbo in slackbuilds:
|
||||
version = SBoQueries(sbo).version()
|
||||
self._view_packages(sbo, version)
|
||||
self._view_build(sbo, version)
|
||||
|
||||
if dependencies:
|
||||
print('Dependencies:')
|
||||
for sbo in dependencies:
|
||||
version = SBoQueries(sbo).version()
|
||||
self._view_packages(sbo, version)
|
||||
self._view_build(sbo, version)
|
||||
|
||||
def install_packages(self, slackbuilds: list, dependencies: list):
|
||||
print('The following packages will be installed or upgraded:\n')
|
||||
|
||||
for sbo in slackbuilds:
|
||||
version = SBoQueries(sbo).version()
|
||||
self._view_packages(sbo, version)
|
||||
self._view_install(sbo, version)
|
||||
|
||||
if dependencies:
|
||||
print('Dependencies:')
|
||||
for sbo in dependencies:
|
||||
version = SBoQueries(sbo).version()
|
||||
self._view_packages(sbo, version)
|
||||
self._view_install(sbo, version)
|
||||
|
||||
def _view_packages(self, sbo: str, version: str):
|
||||
self._view_total(slackbuilds, dependencies)
|
||||
|
||||
def _view_build(self, sbo: str, version: str):
|
||||
color = self.colors()
|
||||
|
||||
if self.utils.is_installed(f'{sbo}-{version}-'):
|
||||
print(f'[{color["CYAN"]} build {color["ENDC"]}] -> '
|
||||
f'{sbo}-{version}')
|
||||
|
||||
def _view_install(self, sbo: str, version: str):
|
||||
color = self.colors()
|
||||
|
||||
if self.utils.is_installed(f'{sbo}-{version}-'):
|
||||
|
@ -48,6 +57,20 @@ class ViewMessage:
|
|||
print(f'[{color["CYAN"]} install {color["ENDC"]}] -> '
|
||||
f'{sbo}-{version}')
|
||||
|
||||
def _view_total(self, slackbuilds: list, dependencies: list):
|
||||
slackbuilds.extend(dependencies)
|
||||
installed = upgraded = 0
|
||||
|
||||
for sbo in slackbuilds:
|
||||
version = SBoQueries(sbo).version()
|
||||
if self.utils.is_installed(f'{sbo}-{version}-'):
|
||||
upgraded += 1
|
||||
else:
|
||||
installed += 1
|
||||
|
||||
print(f'\nTotal {installed} will be installed and '
|
||||
f'{upgraded} will be upgraded.')
|
||||
|
||||
def remove_packages(self):
|
||||
print('The following packages will be removed:\n')
|
||||
|
||||
|
|
Loading…
Reference in a new issue