mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-19 10:27:07 +01:00
Updated read last updated
This commit is contained in:
parent
4845013a6b
commit
a2d7a7f90f
1 changed files with 10 additions and 10 deletions
|
@ -29,17 +29,24 @@ class RepoInfo(Configs):
|
|||
self.enabled: int = 0
|
||||
self.total_packages: int = 0
|
||||
self.repo_data: dict = {}
|
||||
self.dates: dict = {}
|
||||
|
||||
self.option_for_repository: bool = self.utils.is_option(
|
||||
('-o', '--repository='), flags)
|
||||
|
||||
def read_last_updated(self) -> dict:
|
||||
last_updated_json: Path = Path(f'{self.repos.repositories_path}', self.repos.last_update_json)
|
||||
if last_updated_json.is_file():
|
||||
return self.utils.read_json_file(last_updated_json)
|
||||
return {}
|
||||
|
||||
def info(self) -> None:
|
||||
""" Prints information about repositories. """
|
||||
self.dates: dict = self.read_last_updated()
|
||||
if self.option_for_repository:
|
||||
self.repo_data: dict = self.load_data.load(self.repository)
|
||||
else:
|
||||
self.repo_data: dict = self.load_data.load('*')
|
||||
|
||||
self.view_the_title()
|
||||
|
||||
if self.option_for_repository:
|
||||
|
@ -55,13 +62,6 @@ class RepoInfo(Configs):
|
|||
self.total_packages += count
|
||||
return count
|
||||
|
||||
def last_repository_updated(self, repository: str) -> str:
|
||||
last_updated_json: Path = Path(f'{self.repos.repositories_path}', self.repos.last_update_json)
|
||||
dates: dict = self.utils.read_json_file(last_updated_json)
|
||||
if dates.get(repository):
|
||||
return dates[repository]
|
||||
return ''
|
||||
|
||||
def view_the_title(self) -> None:
|
||||
title: str = f'repositories information:'.title()
|
||||
if self.option_for_repository:
|
||||
|
@ -75,7 +75,7 @@ class RepoInfo(Configs):
|
|||
count: int = 0
|
||||
color: str = self.red
|
||||
status: str = 'Disabled'
|
||||
date: str = self.last_repository_updated(self.repository)
|
||||
date: str = self.dates.get(self.repository, 'None')
|
||||
|
||||
if self.repos.repositories[self.repository]['enable']:
|
||||
status: str = 'Enabled'
|
||||
|
@ -90,7 +90,7 @@ class RepoInfo(Configs):
|
|||
count: int = 0
|
||||
color: str = self.red
|
||||
status: str = 'Disabled'
|
||||
date: str = self.last_repository_updated(repo)
|
||||
date: str = self.dates.get(repo, 'None')
|
||||
|
||||
if item['enable']:
|
||||
self.enabled += 1
|
||||
|
|
Loading…
Reference in a new issue