mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-19 10:27:07 +01:00
Updated for skipped
This commit is contained in:
parent
fc306ca789
commit
64f6a6e394
1 changed files with 19 additions and 0 deletions
|
@ -20,13 +20,18 @@ class Packages(Configs):
|
|||
self.repo: str = repo
|
||||
self.mode: str = mode
|
||||
|
||||
self.color = self.colour()
|
||||
self.utils = Utilities()
|
||||
self.repos = Repositories()
|
||||
self.view_message = ViewMessage(self.flags)
|
||||
|
||||
self.cyan: str = self.color['cyan']
|
||||
self.endc: str = self.color['endc']
|
||||
|
||||
self.binary_packages: list = []
|
||||
self.flag_binary: list = ['-B', '--binary']
|
||||
self.flag_reinstall: list = ['-r', '--reinstall']
|
||||
self.flag_skip_installed: list = ['-k', '--skip-installed']
|
||||
|
||||
def execute(self) -> None:
|
||||
self.view_message.install_packages(self.packages, self.mode)
|
||||
|
@ -40,6 +45,9 @@ class Packages(Configs):
|
|||
pkg_urls: list = []
|
||||
for pkg in self.packages:
|
||||
|
||||
if self.skip_installed_package(pkg):
|
||||
continue
|
||||
|
||||
mirror: str = BinQueries(pkg, self.repo).mirror()
|
||||
location: str = BinQueries(pkg, self.repo).location()
|
||||
package: str = BinQueries(pkg, self.repo).package_bin()
|
||||
|
@ -67,4 +75,15 @@ class Packages(Configs):
|
|||
|
||||
for package in self.binary_packages:
|
||||
command: str = f'{slack_command} {self.tmp_slpkg}/{package}'
|
||||
|
||||
if self.skip_installed_package(package):
|
||||
continue
|
||||
|
||||
self.utils.process(command)
|
||||
|
||||
def skip_installed_package(self, package) -> bool:
|
||||
""" Skip installed package when the option --skip-installed is applied. """
|
||||
if (self.utils.is_option(self.flag_skip_installed, self.flags) and
|
||||
self.utils.is_package_installed(package, self.file_pattern)):
|
||||
print(f"slpkg: package '{self.cyan}{package}{self.endc}' skipped by the user.")
|
||||
return True
|
||||
|
|
Loading…
Reference in a new issue