Add script indent_begin_end.py to make logs more readable.

This commit is contained in:
Ivan Baravy 2020-05-19 14:21:47 +03:00
parent 5dbe6cb8f2
commit 631271c94a

15
indent_begin_end.py Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env python
import sys
indent = b""
with open(sys.argv[1], 'rb') as fin:
with open(sys.argv[2], 'wb') as fout:
for line in fin:
if line.endswith(b"end\r\n"):
indent = indent[:-2]
fout.write(indent)
fout.write(line)
if line.endswith(b"begin\r\n"):
indent = indent + b" "