Fixed messages

This commit is contained in:
Dimitris Zlatanidis 2022-06-19 17:50:36 +03:00
parent 8deb20f1b5
commit 8b717bfa69

View file

@ -25,6 +25,8 @@ class ViewMessage:
version = SBoQueries(sbo).version()
self._view_build(sbo, version)
self._view_total(slackbuilds, dependencies, method='build')
def install_packages(self, slackbuilds: list, dependencies: list):
print('The following packages will be installed or upgraded:\n')
@ -38,12 +40,15 @@ class ViewMessage:
version = SBoQueries(sbo).version()
self._view_install(sbo, version)
self._view_total(slackbuilds, dependencies)
self._view_total(slackbuilds, dependencies, method='install')
def _view_build(self, sbo: str, version: str):
color = self.colors()
if self.utils.is_installed(f'{sbo}-{version}-'):
print(f'[{color["YELLOW"]} build {color["ENDC"]}] -> '
f'{sbo}-{version}')
else:
print(f'[{color["CYAN"]} build {color["ENDC"]}] -> '
f'{sbo}-{version}')
@ -57,7 +62,7 @@ class ViewMessage:
print(f'[{color["CYAN"]} install {color["ENDC"]}] -> '
f'{sbo}-{version}')
def _view_total(self, slackbuilds: list, dependencies: list):
def _view_total(self, slackbuilds: list, dependencies: list, method):
color = self.colors()
slackbuilds.extend(dependencies)
@ -70,8 +75,12 @@ class ViewMessage:
else:
installed += 1
print(f'\n{color["GREY"]}Total {installed} will be installed and '
f'{upgraded} will be upgraded.{color["ENDC"]}')
if method == 'install':
print(f'\n{color["GREY"]}Total {installed} will be installed and '
f'{upgraded} will be upgraded.{color["ENDC"]}')
else:
print(f'\n{color["GREY"]}Total {installed + upgraded} packages '
f'will be build.{color["ENDC"]}')
def remove_packages(self):
print('The following packages will be removed:\n')