Created
January 9, 2020 15:43
-
-
Save Fedjmike/a1c019c114d262d8a23cf459ea7fef8f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys, os | |
def fix_eol(filename): | |
with open(filename) as f: | |
contents = f.read() | |
if not contents.endswith("\n"): | |
contents += "\n" | |
with open(filename, "w") as f: | |
f.write(contents) | |
if len(sys.argv) > 1: | |
fix_eol(sys.argv[1]) | |
else: | |
for filename in os.listdir(): | |
if filename.endswith(".json"): | |
fix_eol(filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment