From 8b444ff1f53b78746631f8187c5b895399a63b7a Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 21 May 2023 23:44:08 +0300 Subject: [PATCH] Updated for database load --- slpkg/main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/slpkg/main.py b/slpkg/main.py index 76cedb9d..03f61c46 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -47,6 +47,7 @@ class Argparse(Configs): self.usage = Usage() self.form_configs = FormConfigs() self.repos = Repositories() + self.check = None self.repository: str = self.repos.default_repository @@ -312,8 +313,6 @@ class Argparse(Configs): self.is_binary: bool = self.utils.is_binary_repo(self.repository) - self.check = Check(self.repository, self.data) - logging.basicConfig(filename=LoggingConfig.log_file, filemode=LoggingConfig.filemode, encoding=LoggingConfig.encoding, @@ -346,6 +345,9 @@ class Argparse(Configs): else: self.data: dict = SBoQueries(self.repository).repository_data() + # Create object for the checks + self.check = Check(self.repository, self.data) + def invalid_options(self) -> None: """ Checks for invalid options. """ invalid, commands, repeat = [], [], [] @@ -709,11 +711,11 @@ class Argparse(Configs): command: str = Argparse.find.__name__ if len(self.args) >= 2: + self.load_database() self.check.is_database_empty() packages: list = self.is_file_list_packages() if self.utils.is_option(self.flag_no_cases, self.flags) or not self.case_sensitive: - self.load_database() packages: list = self.utils.case_insensitive_pattern_matching(packages, self.data) if self.utils.is_option(self.flag_searches, self.flags): @@ -753,11 +755,11 @@ class Argparse(Configs): command: str = Argparse.search.__name__ if len(self.args) >= 2: + self.load_database() self.check.is_database_empty() packages: list = self.is_file_list_packages() if self.utils.is_option(self.flag_no_cases, self.flags) or not self.case_sensitive: - self.load_database() packages: list = self.utils.case_insensitive_pattern_matching(packages, self.data) if self.utils.is_option(self.flag_searches, self.flags):