mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-29 10:26:12 +01:00
Updated for tuples
This commit is contained in:
parent
90e7012e64
commit
bf5d286d59
2 changed files with 12 additions and 12 deletions
|
@ -48,9 +48,6 @@ class Menu(Configs):
|
||||||
|
|
||||||
self.repository: str = self.repos.default_repository
|
self.repository: str = self.repos.default_repository
|
||||||
|
|
||||||
if len(args) == 0 or '' in args:
|
|
||||||
self.usage.help_short(1)
|
|
||||||
|
|
||||||
self.data: dict = {}
|
self.data: dict = {}
|
||||||
self.flag_yes: str = '--yes'
|
self.flag_yes: str = '--yes'
|
||||||
self.flag_short_yes: str = '-y'
|
self.flag_short_yes: str = '-y'
|
||||||
|
@ -81,17 +78,17 @@ class Menu(Configs):
|
||||||
self.flag_directory: str = '--directory='
|
self.flag_directory: str = '--directory='
|
||||||
self.flag_short_directory: str = '-z'
|
self.flag_short_directory: str = '-z'
|
||||||
|
|
||||||
self.flag_searches: list = [
|
self.flag_searches: tuple = (
|
||||||
self.flag_short_search,
|
self.flag_short_search,
|
||||||
self.flag_search
|
self.flag_search
|
||||||
]
|
)
|
||||||
|
|
||||||
self.flag_no_cases: list = [
|
self.flag_no_cases: tuple = (
|
||||||
self.flag_no_case,
|
self.flag_no_case,
|
||||||
self.flag_short_no_case
|
self.flag_short_no_case
|
||||||
]
|
)
|
||||||
|
|
||||||
self.options: list = [
|
self.options: tuple = (
|
||||||
self.flag_yes,
|
self.flag_yes,
|
||||||
self.flag_short_yes,
|
self.flag_short_yes,
|
||||||
self.flag_jobs,
|
self.flag_jobs,
|
||||||
|
@ -120,7 +117,7 @@ class Menu(Configs):
|
||||||
self.flag_short_repository,
|
self.flag_short_repository,
|
||||||
self.flag_directory,
|
self.flag_directory,
|
||||||
self.flag_short_directory,
|
self.flag_short_directory,
|
||||||
]
|
)
|
||||||
|
|
||||||
self.commands: dict = {
|
self.commands: dict = {
|
||||||
'--help': [],
|
'--help': [],
|
||||||
|
@ -325,9 +322,9 @@ class Menu(Configs):
|
||||||
|
|
||||||
def check_for_repositories(self) -> None:
|
def check_for_repositories(self) -> None:
|
||||||
""" Checks combination for binaries use repositories only and if repository exists. """
|
""" Checks combination for binaries use repositories only and if repository exists. """
|
||||||
except_options: list = [
|
except_options: tuple = (
|
||||||
'-s', 'search',
|
'-s', 'search',
|
||||||
]
|
)
|
||||||
if self.repository == '*' and not self.utils.is_option(except_options, self.args):
|
if self.repository == '*' and not self.utils.is_option(except_options, self.args):
|
||||||
self.usage.help_minimal(f"{self.prog_name}: invalid repository '{self.repository}'")
|
self.usage.help_minimal(f"{self.prog_name}: invalid repository '{self.repository}'")
|
||||||
|
|
||||||
|
@ -841,6 +838,9 @@ def main() -> None:
|
||||||
args.pop(0)
|
args.pop(0)
|
||||||
usage = Usage()
|
usage = Usage()
|
||||||
|
|
||||||
|
if len(args) == 0 or '' in args:
|
||||||
|
usage.help_short(1)
|
||||||
|
|
||||||
sub_menu = SubMenu(args)
|
sub_menu = SubMenu(args)
|
||||||
arguments_no_options: dict[str] = {
|
arguments_no_options: dict[str] = {
|
||||||
'-h': sub_menu.help,
|
'-h': sub_menu.help,
|
||||||
|
|
|
@ -107,7 +107,7 @@ class Utilities(Configs):
|
||||||
return build
|
return build
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_option(options: list, flags: list) -> bool:
|
def is_option(options: tuple, flags: list) -> bool:
|
||||||
""" Checking if the option is applied. """
|
""" Checking if the option is applied. """
|
||||||
for option in options:
|
for option in options:
|
||||||
if option in flags:
|
if option in flags:
|
||||||
|
|
Loading…
Reference in a new issue