Fix error display bug from previous commit, reset colors & print new line after displaying file

This commit is contained in:
Lavender 2021-04-04 13:44:38 -07:00
parent 814fef2ba3
commit cf1da03eeb
Signed by: endie
GPG Key ID: CC5162D7C2146F01
1 changed files with 5 additions and 3 deletions

8
pat.py
View File

@ -29,9 +29,9 @@ for arg in argv[1:]:
read_result = file.read(bytes_to_read)
except Exception as e:
print(
f"Error \
{f'reading {file.name}' if 'file' in globals() else 'opening file'}\
: {e}",
"Error "
+ (f"reading {file.name}" if "file" in globals() else "opening file")
+ f": {e}",
file=stderr,
)
continue
@ -61,3 +61,5 @@ for arg in argv[1:]:
print("\x1b[38;2;%d;%d;%dm%s" % (red, green, blue, char), end="")
index += step
print("\x1b[0m")