@ 260802.2

200805.1 · b7916f5453bc32f0fc16400cb378afbba2762ef9

bin: add quick script to unescape things

This is useful for logs that squash backtraces into a single line but preserve newlines (or tabs) by escaping them. This undoes that process to "prettify" the backtraces.

reading declarations

Changes to bin/unescape. All files

bin/unescape

new file mode 100755@@ -0,0 +1,19 @@+#!/usr/bin/env python3++import argparse+import sys++if __name__ == '__main__':+    p = argparse.ArgumentParser(+        description='Automatically unescape text on stdin. This is useful '+                    'for prettifying stack traces in logs that have been '+                    'squashed into a single line.'+    )+    _ = p.parse_args()++    inp = sys.stdin+    for line in inp:+        line = line.replace('\\r', '\r')+        line = line.replace('\\n', '\n')+        line = line.replace('\\t', '\t')+        print(line, end='')