mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-26 09:58:31 +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
|
||||
Added:
|
||||
- Case-insensitive pattern matching, --no-case option
|
||||
|
|
|
@ -20,15 +20,15 @@ class FindInstalled(Configs):
|
|||
|
||||
def find(self) -> None:
|
||||
self.view_title()
|
||||
for pkg in self.packages:
|
||||
for package in self.utils.installed_packages.values():
|
||||
for package in self.packages:
|
||||
for name in self.utils.installed_packages.values():
|
||||
|
||||
if self.option_for_no_case:
|
||||
pkg: str = pkg.lower()
|
||||
package: str = package.lower()
|
||||
# if self.option_for_no_case:
|
||||
# name: str = name.lower()
|
||||
# package: str = package.lower()
|
||||
|
||||
if pkg in package or pkg == '*':
|
||||
self.matching.append(package)
|
||||
if package in name or package == '*' or self.is_not_case_sensitive(package, name):
|
||||
self.matching.append(name)
|
||||
self.matched()
|
||||
|
||||
def view_title(self) -> None:
|
||||
|
@ -48,3 +48,7 @@ class FindInstalled(Configs):
|
|||
|
||||
def view_summary(self) -> None:
|
||||
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 name, data_pkg in self.repo_data.items():
|
||||
|
||||
if self.option_for_no_case:
|
||||
package: str = package.lower()
|
||||
name: str = name.lower()
|
||||
|
||||
if package in name or package == '*':
|
||||
if package in name or package == '*' or self.is_not_case_sensitive(package, name):
|
||||
self.matching += 1
|
||||
|
||||
self.data_dict[self.matching] = {
|
||||
|
@ -82,3 +78,7 @@ class SearchPackage(Configs):
|
|||
print(f'\n{self.grey}Total found {self.matching} packages.{self.endc}')
|
||||
else:
|
||||
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