mirror of
https://github.com/cheat/cheat.git
synced 2024-11-23 22:41:35 +01:00
Changed search behavior to lower the search term and the lines being searched, thus providing case-insensitive search
This commit is contained in:
parent
334040ee07
commit
7fe5ff7905
@ -79,11 +79,12 @@ def list():
|
|||||||
def search(term):
|
def search(term):
|
||||||
""" Searches all cheatsheets for the specified term """
|
""" Searches all cheatsheets for the specified term """
|
||||||
result = ''
|
result = ''
|
||||||
|
term_lowered = term.lower()
|
||||||
|
|
||||||
for cheatsheet in sorted(get().items()):
|
for cheatsheet in sorted(get().items()):
|
||||||
match = ''
|
match = ''
|
||||||
for line in open(cheatsheet[1]):
|
for line in open(cheatsheet[1]):
|
||||||
if term in line:
|
if term_lowered in line.lower():
|
||||||
match += ' ' + line
|
match += ' ' + line
|
||||||
|
|
||||||
if match != '':
|
if match != '':
|
||||||
|
Loading…
Reference in New Issue
Block a user