Added --pkg-version option

This commit is contained in:
Dimitris Zlatanidis 2024-04-07 21:51:21 +03:00
parent cb01d0e84f
commit f0433837ef
3 changed files with 12 additions and 2 deletions

View file

@ -3,6 +3,7 @@
### 5.0.5 - 07/04/2024
- Added:
* Added maximum parallel for downloading in the config file
* Added --pkg-version option in search command
- Updated:
* Updated to exclude packages from slack_extra repository (Thanks to Marav)

View file

@ -225,6 +225,8 @@ class Menu(Configs):
self.flag_short_search,
self.flag_repository,
self.flag_short_repository,
self.flag_pkg_version,
self.flag_short_pkg_version,
self.flag_no_case,
self.flag_short_no_case
],

View file

@ -25,6 +25,9 @@ class SearchPackage(Configs):
self.option_for_no_case: bool = self.utils.is_option(
('-m', '--no-case'), flags)
self.option_for_pkg_version: bool = self.utils.is_option(
('-p', '--pkg-version'), flags)
def search(self) -> None:
if self.repository == '*':
self.search_to_all_repositories()
@ -55,6 +58,7 @@ class SearchPackage(Configs):
}
def summary_of_searching(self) -> None:
version: str = ''
try:
repo_length: int = max(len(repo['repository']) for repo in self.data_dict.values())
except ValueError:
@ -67,8 +71,11 @@ class SearchPackage(Configs):
if self.matching:
for item in self.data_dict.values():
print(f"{item['repository']:<{repo_length}}: {self.cyan}{item['name']:<{name_length}}{self.endc} "
f"{self.yellow}{item['version']}{self.endc}")
if self.option_for_pkg_version:
version: str = item['version']
print(f"{item['repository']:<{repo_length}} : {self.cyan}{item['name']:<{name_length}}{self.endc} "
f"{self.yellow}{version}{self.endc}")
print(f'\n{self.grey}Total found {self.matching} packages.{self.endc}')
else: