Merge pull request #418 from chrisallenlane/issue-372

Addressing issue #372
This commit is contained in:
Chris Allen Lane 2019-01-27 14:45:41 -05:00 committed by GitHub
commit 7e35263e90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -1,3 +1,4 @@
import io
import os import os
import shutil import shutil
@ -74,5 +75,5 @@ class Sheet:
if not self.exists(sheet): if not self.exists(sheet):
Utils.die('No cheatsheet found for ' + sheet) Utils.die('No cheatsheet found for ' + sheet)
with open(self.path(sheet)) as cheatfile: with io.open(self.path(sheet), encoding='utf-8') as cheatfile:
return cheatfile.read() return cheatfile.read()

View File

@ -1,3 +1,4 @@
import io
import os import os
from cheat.utils import Utils from cheat.utils import Utils
@ -92,7 +93,7 @@ class Sheets:
for cheatsheet in sorted(self.get().items()): for cheatsheet in sorted(self.get().items()):
match = '' match = ''
for line in open(cheatsheet[1]): for line in io.open(cheatsheet[1], encoding='utf-8'):
if term in line: if term in line:
match += ' ' + self._utils.highlight(term, line) match += ' ' + self._utils.highlight(term, line)