forked from HandBrake/HandBrake
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scripts: Add utolf.py helper script.
Converts line endings to lf.
- Loading branch information
1 parent
79bdc5e
commit 477b393
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#/usr/bin/env python3 | ||
|
||
import os | ||
import sys | ||
|
||
def main(): | ||
filenames = sys.argv[1:] | ||
if filenames: | ||
convert(filenames) | ||
else: | ||
print("Usage: <command> filename [filename ...]") | ||
|
||
def convert(files): | ||
for file in files: | ||
print(file) | ||
with open(file, 'r') as infile, \ | ||
open(file + '.tmp', 'w', newline='\n') as outfile: | ||
outfile.writelines(infile.readlines()) | ||
os.replace(file + '.tmp', file) | ||
|
||
if __name__ == "__main__": | ||
main() |