diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2023-12-27 18:33:06 +0100 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2023-12-27 18:33:06 +0100 |
commit | ccc9b6abb66ebda0b91b4e21f8ec2fb2e87390f7 (patch) | |
tree | 985f9d136a981ec7cc43984c976c60e9295340d5 /tests/instrumentation/unix2dos.py | |
parent | 7744625c18aff5990a792bb13a44b60d8c4d4fc5 (diff) | |
download | aerogramme-ccc9b6abb66ebda0b91b4e21f8ec2fb2e87390f7.tar.gz aerogramme-ccc9b6abb66ebda0b91b4e21f8ec2fb2e87390f7.zip |
add a --dev mode
Diffstat (limited to 'tests/instrumentation/unix2dos.py')
-rwxr-xr-x | tests/instrumentation/unix2dos.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/instrumentation/unix2dos.py b/tests/instrumentation/unix2dos.py new file mode 100755 index 0000000..4e6c9cf --- /dev/null +++ b/tests/instrumentation/unix2dos.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +import sys + +buf = "" +with open(sys.argv[1], 'r+b') as f: + buf = f.read() + +if buf.find(b'\r\n'): + print(f"{sys.argv[1]} is already a CRLF file") + sys.exit(1) + +buf = buf.replace(b'\n', b'\r\n') + +with open(sys.argv[1], 'w+b') as f: + f.write(buf) |