mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-29 20:34:22 +01:00
Updated for summary
This commit is contained in:
parent
2be33d8780
commit
b9a7309286
1 changed files with 30 additions and 24 deletions
|
@ -26,6 +26,7 @@ class ViewMessage(Configs):
|
|||
self.upgrade = Upgrade(repository, data)
|
||||
|
||||
self.download_only = None
|
||||
self.summary_message: str = str()
|
||||
self.is_binary: bool = self.utils.is_binary_repo(repository)
|
||||
|
||||
self.option_for_resolve_off: bool = self.utils.is_option(
|
||||
|
@ -167,7 +168,6 @@ class ViewMessage(Configs):
|
|||
|
||||
def view_summary(self, packages: list, dependencies: list, option: str) -> None:
|
||||
packages.extend(dependencies)
|
||||
summary_message: str = str()
|
||||
install = upgrade = remove = size_comp = size_uncomp = size_rmv = int()
|
||||
|
||||
for pkg in packages:
|
||||
|
@ -198,33 +198,39 @@ class ViewMessage(Configs):
|
|||
self.ascii.draw_bottom_line()
|
||||
|
||||
if option in ['install', 'upgrade']:
|
||||
summary_message: str = (
|
||||
f'{self.grey}Total {install} packages will be '
|
||||
f'installed and {upgrade} will be upgraded, and total '
|
||||
f'{self.utils.convert_file_sizes(size_comp)} will be downloaded and '
|
||||
f'{self.utils.convert_file_sizes(size_uncomp)} will be installed.{self.endc} '
|
||||
)
|
||||
|
||||
self.summary_for_install_and_upgrade(install, upgrade, size_comp, size_uncomp)
|
||||
elif option == 'build':
|
||||
summary_message: str = (
|
||||
f'{self.grey}Total {len(packages)} packages '
|
||||
f'will be build in {self.tmp_path} folder.{self.endc}'
|
||||
)
|
||||
|
||||
self.summary_for_build(packages)
|
||||
elif option == 'remove':
|
||||
summary_message: str = (
|
||||
f'{self.grey}Total {remove} packages '
|
||||
f'will be removed and {self.utils.convert_file_sizes(size_rmv)} '
|
||||
f'of space will be freed up.{self.endc}'
|
||||
)
|
||||
|
||||
self.summary_for_remove(remove, size_rmv)
|
||||
elif option == 'download':
|
||||
summary_message: str = (
|
||||
f'{self.grey}Total {len(packages)} packages and {self.utils.convert_file_sizes(size_comp)} '
|
||||
f'will be downloaded in {self.download_only} folder.{self.endc}'
|
||||
)
|
||||
self.summary_for_download(packages, size_comp)
|
||||
|
||||
print(summary_message)
|
||||
print(self.summary_message)
|
||||
|
||||
def summary_for_install_and_upgrade(self, install: int, upgrade: int, size_comp: int, size_uncomp: int) -> None:
|
||||
self.summary_message: str = (
|
||||
f'{self.grey}Total {install} packages will be '
|
||||
f'installed and {upgrade} will be upgraded, and total '
|
||||
f'{self.utils.convert_file_sizes(size_comp)} will be downloaded and '
|
||||
f'{self.utils.convert_file_sizes(size_uncomp)} will be installed.{self.endc} ')
|
||||
|
||||
def summary_for_build(self, packages: list) -> None:
|
||||
self.summary_message: str = (
|
||||
f'{self.grey}Total {len(packages)} packages '
|
||||
f'will be build in {self.tmp_path} folder.{self.endc}')
|
||||
|
||||
def summary_for_remove(self, remove: int, size_rmv: int) -> None:
|
||||
self.summary_message: str = (
|
||||
f'{self.grey}Total {remove} packages '
|
||||
f'will be removed and {self.utils.convert_file_sizes(size_rmv)} '
|
||||
f'of space will be freed up.{self.endc}')
|
||||
|
||||
def summary_for_download(self, packages: list, size_comp: int) -> None:
|
||||
self.summary_message: str = (
|
||||
f'{self.grey}Total {len(packages)} packages and {self.utils.convert_file_sizes(size_comp)} '
|
||||
f'will be downloaded in {self.download_only} folder.{self.endc}'
|
||||
)
|
||||
|
||||
def build_package_and_version(self, package: str) -> str:
|
||||
installed_package: str = self.utils.is_package_installed(package)
|
||||
|
|
Loading…
Add table
Reference in a new issue