mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
Fixed for IndexError
This commit is contained in:
parent
80e66c1066
commit
ddf61a6a3f
1 changed files with 20 additions and 5 deletions
|
@ -285,7 +285,14 @@ class Argparse(Configs):
|
|||
""" Checks combination for binaries use repositories only and if repository exists. """
|
||||
if self.utils.is_option(self.flag_binaries, self.flags):
|
||||
|
||||
except_options: list = ['-s', 'search', '-u', 'update', '-c', 'check-updates']
|
||||
except_options: list = [
|
||||
'-s', 'search',
|
||||
'-u', 'update',
|
||||
'-c', 'check-updates',
|
||||
'-t', 'tracking',
|
||||
'-e', 'dependees',
|
||||
'-w', 'view'
|
||||
]
|
||||
|
||||
if self.binary_repo == '*' and not self.utils.is_option(except_options, self.args):
|
||||
self.usage.help_minimal(f"{self.prog_name}: invalid binary repository '{self.binary_repo}'")
|
||||
|
@ -361,16 +368,24 @@ class Argparse(Configs):
|
|||
self.args[self.args.index(arg)] = self.flag_directory
|
||||
|
||||
if arg.startswith(self.flag_short_directory) and len(self.args) > 3:
|
||||
self.directory: str = self.args[self.args.index(arg) + 1]
|
||||
self.args.remove(self.directory)
|
||||
try:
|
||||
self.directory: str = self.args[self.args.index(arg) + 1]
|
||||
except IndexError:
|
||||
self.directory: Path = self.tmp_slpkg
|
||||
else:
|
||||
self.args.remove(self.directory)
|
||||
|
||||
if arg.startswith(self.flag_bin_repository):
|
||||
self.binary_repo: str = arg.split('=')[1]
|
||||
self.args[self.args.index(arg)] = self.flag_bin_repository
|
||||
|
||||
if arg.startswith(self.flag_short_bin_repository) and len(self.args) > 2:
|
||||
self.binary_repo: str = self.args[self.args.index(arg) + 1]
|
||||
self.args.remove(self.binary_repo)
|
||||
try:
|
||||
self.binary_repo: str = self.args[self.args.index(arg) + 1]
|
||||
except IndexError:
|
||||
self.binary_repo: str = ''
|
||||
else:
|
||||
self.args.remove(self.binary_repo)
|
||||
|
||||
def move_options(self) -> None:
|
||||
""" Move options to the flags and removes from the arguments. """
|
||||
|
|
Loading…
Reference in a new issue