diff options
Diffstat (limited to 'epubgrep.py')
-rwxr-xr-x | epubgrep.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/epubgrep.py b/epubgrep.py index b62c67a..d6e44cf 100755 --- a/epubgrep.py +++ b/epubgrep.py @@ -74,13 +74,14 @@ def grep_book(filename: str, pattern: str, flags: int, counting: bool=False, col printed_title = True # https://stackoverflow.com/a/33206814 # print("\033[31;1;4mHello\033[0m") - if color: - found_line = decoded_line.replace( - res.group(1), - "\033[31;1m" + res.group(1) + "\033[31;0m") - print('{}'.format(found_line)) - else: - print(decoded_line) + if not counting: + if color: + found_line = decoded_line.replace( + res.group(1), + "\033[31;1m" + res.group(1) + "\033[31;0m") + print('{}'.format(found_line)) + else: + print(decoded_line) if count > 0: print('Found: {}'.format(count)) |