mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-15 03:41:16 +01:00
Fixed case-sensitive
This commit is contained in:
parent
c9e871b4a6
commit
168c38309a
3 changed files with 20 additions and 12 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
4.8.5 - 18/05/2023
|
||||||
|
Fixed:
|
||||||
|
- Case-sensitive with commands find and search
|
||||||
|
|
||||||
4.8.4 - 14/05/2023
|
4.8.4 - 14/05/2023
|
||||||
Added:
|
Added:
|
||||||
- Case-insensitive pattern matching, --no-case option
|
- Case-insensitive pattern matching, --no-case option
|
||||||
|
|
|
@ -20,15 +20,15 @@ class FindInstalled(Configs):
|
||||||
|
|
||||||
def find(self) -> None:
|
def find(self) -> None:
|
||||||
self.view_title()
|
self.view_title()
|
||||||
for pkg in self.packages:
|
for package in self.packages:
|
||||||
for package in self.utils.installed_packages.values():
|
for name in self.utils.installed_packages.values():
|
||||||
|
|
||||||
if self.option_for_no_case:
|
# if self.option_for_no_case:
|
||||||
pkg: str = pkg.lower()
|
# name: str = name.lower()
|
||||||
package: str = package.lower()
|
# package: str = package.lower()
|
||||||
|
|
||||||
if pkg in package or pkg == '*':
|
if package in name or package == '*' or self.is_not_case_sensitive(package, name):
|
||||||
self.matching.append(package)
|
self.matching.append(name)
|
||||||
self.matched()
|
self.matched()
|
||||||
|
|
||||||
def view_title(self) -> None:
|
def view_title(self) -> None:
|
||||||
|
@ -48,3 +48,7 @@ class FindInstalled(Configs):
|
||||||
|
|
||||||
def view_summary(self) -> None:
|
def view_summary(self) -> None:
|
||||||
print(f'\n{self.grey}Total found {len(self.matching)} packages.{self.endc}')
|
print(f'\n{self.grey}Total found {len(self.matching)} packages.{self.endc}')
|
||||||
|
|
||||||
|
def is_not_case_sensitive(self, package: str, name: str) -> bool:
|
||||||
|
if self.option_for_no_case:
|
||||||
|
return package.lower() in name.lower()
|
||||||
|
|
|
@ -59,11 +59,7 @@ class SearchPackage(Configs):
|
||||||
for package in self.packages:
|
for package in self.packages:
|
||||||
for name, data_pkg in self.repo_data.items():
|
for name, data_pkg in self.repo_data.items():
|
||||||
|
|
||||||
if self.option_for_no_case:
|
if package in name or package == '*' or self.is_not_case_sensitive(package, name):
|
||||||
package: str = package.lower()
|
|
||||||
name: str = name.lower()
|
|
||||||
|
|
||||||
if package in name or package == '*':
|
|
||||||
self.matching += 1
|
self.matching += 1
|
||||||
|
|
||||||
self.data_dict[self.matching] = {
|
self.data_dict[self.matching] = {
|
||||||
|
@ -82,3 +78,7 @@ class SearchPackage(Configs):
|
||||||
print(f'\n{self.grey}Total found {self.matching} packages.{self.endc}')
|
print(f'\n{self.grey}Total found {self.matching} packages.{self.endc}')
|
||||||
else:
|
else:
|
||||||
print('\nDoes not match any package.\n')
|
print('\nDoes not match any package.\n')
|
||||||
|
|
||||||
|
def is_not_case_sensitive(self, package: str, name: str) -> bool:
|
||||||
|
if self.option_for_no_case:
|
||||||
|
return package.lower() in name.lower()
|
||||||
|
|
Loading…
Reference in a new issue