Updated for data

This commit is contained in:
Dimitris Zlatanidis 2024-03-18 12:07:57 +02:00
parent 11a5540d8a
commit 01d74a23b2
2 changed files with 11 additions and 3 deletions

View file

@ -297,7 +297,7 @@ class Menu(Configs):
def check_for_repositories(self) -> None:
""" Checks a combination for binaries use repositories only and if repository exists. """
except_options: tuple = (
'-s', 'search',
'-s', 'search'
)
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}'")

View file

@ -26,12 +26,18 @@ class RepoInfo(Configs):
self.enabled: int = 0
self.total_packages: int = 0
self.repo_data: dict = {}
self.option_for_repository: bool = self.utils.is_option(
('-o', '--repository='), flags)
def info(self) -> None:
""" Prints information about repositories. """
if self.option_for_repository:
self.repo_data: dict = self.utils.load_data(self.repository)
else:
self.repo_data: dict = self.utils.load_data('*')
self.view_the_title()
if self.option_for_repository:
@ -40,8 +46,10 @@ class RepoInfo(Configs):
self.view_the_repositories_information()
def count_the_packages(self, repository: str) -> int:
repo_data: dict = self.utils.load_data(repository)
count: int = len(repo_data.keys())
if self.option_for_repository:
count: int = len(self.repo_data.keys())
else:
count: int = len(self.repo_data[repository].keys())
self.total_packages += count
return count