Move a helper script (indent_begin_end.py) to contrib dir

This commit is contained in:
2023-02-16 19:24:59 +00:00
parent e2afb85d9f
commit 99515bca17

15
contrib/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" "