mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-28 09:58:21 +01:00
Fix for search command
This commit is contained in:
parent
30a6412115
commit
bd278c6162
2 changed files with 7 additions and 6 deletions
|
@ -602,15 +602,15 @@ class Menu(Configs):
|
|||
|
||||
def search(self) -> None:
|
||||
command: str = Menu.search.__name__
|
||||
self.data: dict = self.utils.load_data(self.repository)
|
||||
|
||||
if len(self.args) >= 2:
|
||||
packages: list = self.is_file_list_packages()
|
||||
|
||||
if self.utils.is_option(self.flag_searches, self.flags):
|
||||
self.data: dict = self.utils.load_data(self.repository)
|
||||
packages: list = self.choose.packages(self.data, packages, command)
|
||||
|
||||
pkgs = SearchPackage(self.flags, packages, self.repository)
|
||||
pkgs = SearchPackage(self.flags, packages, self.data, self.repository)
|
||||
pkgs.search()
|
||||
raise SystemExit(0)
|
||||
self.usage.help_short(1)
|
||||
|
|
|
@ -10,9 +10,10 @@ from slpkg.repositories import Repositories
|
|||
class SearchPackage(Configs):
|
||||
""" Search packages from the repositories. """
|
||||
|
||||
def __init__(self, flags: list, packages: list, repository: str):
|
||||
def __init__(self, flags: list, packages: list, data: dict, repository: str):
|
||||
super(Configs, self).__init__()
|
||||
self.packages: list = packages
|
||||
self.data: dict = data
|
||||
self.repository: str = repository
|
||||
self.ascii = AsciiBox()
|
||||
|
||||
|
@ -20,8 +21,8 @@ class SearchPackage(Configs):
|
|||
self.repos = Repositories()
|
||||
|
||||
self.matching: int = 0
|
||||
self.repo_data: dict = {}
|
||||
self.data_dict: dict = {}
|
||||
self.repo_data: dict = {}
|
||||
|
||||
self.option_for_no_case: bool = self.utils.is_option(
|
||||
('-m', '--no-case'), flags)
|
||||
|
@ -30,7 +31,7 @@ class SearchPackage(Configs):
|
|||
if self.repository == '*':
|
||||
self.search_to_all_repositories()
|
||||
else:
|
||||
self.repo_data: dict = self.utils.load_data(self.repository)
|
||||
self.repo_data: dict = self.data
|
||||
self.search_for_the_packages(self.repository)
|
||||
|
||||
print(f'The list below shows the repo '
|
||||
|
@ -38,7 +39,7 @@ class SearchPackage(Configs):
|
|||
self.summary_of_searching()
|
||||
|
||||
def search_to_all_repositories(self) -> None:
|
||||
all_data: dict = self.utils.load_data(self.repository)
|
||||
all_data: dict = self.data
|
||||
for name, repo in all_data.items():
|
||||
self.repo_data: dict = repo
|
||||
self.search_for_the_packages(name)
|
||||
|
|
Loading…
Reference in a new issue