Revert "Added a -S option to allow for keyword searching with ignored case"

This reverts commit def6aee807.
This commit is contained in:
Tyler Culp 2018-09-20 13:37:36 -04:00
parent def6aee807
commit 334040ee07
3 changed files with 4 additions and 14 deletions

View File

@ -8,7 +8,6 @@ Usage:
cheat <cheatsheet>
cheat -e <cheatsheet>
cheat -s <keyword>
cheat -S <keyword>
cheat -l
cheat -d
cheat -v
@ -18,7 +17,6 @@ Options:
-e --edit Edit cheatsheet
-l --list List cheatsheets
-s --search Search cheatsheets for <keyword>
-S --search-ignore-case Search cheatsheets for <keyword>, ignoring case
-v --version Print the version number
Examples:
@ -60,11 +58,7 @@ if __name__ == '__main__':
# search among the cheatsheets
elif options['--search']:
print(colorize(sheets.search(options['<keyword>'], True)))
# search among the cheatsheets, ignoring case
elif options['--search-ignore-case']:
print(colorize(sheets.search(options['<keyword>'], False)))
print(colorize(sheets.search(options['<keyword>'])))
# print the cheatsheet
else:

View File

@ -76,19 +76,15 @@ def list():
return sheet_list
def search(term, match_case):
def search(term):
""" Searches all cheatsheets for the specified term """
result = ''
for cheatsheet in sorted(get().items()):
match = ''
for line in open(cheatsheet[1]):
if match_case:
if term in line:
match += ' ' + line
else:
if term.lower() in line.lower():
match += ' ' + line
if match != '':
result += cheatsheet[0] + ":\n" + match + "\n"

Binary file not shown.