Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(420)

Side by Side Diff: tools/refactoring/trim.py

Issue 1581573003: Remove tools/refactoring. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/refactoring/stringmanipulation.py ('k') | tools/refactoring/trimall.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2
3 import sys
4 import fileinput
5
6 # Defaults
7 TABSIZE = 4
8
9 usage = """
10 Replaces all TAB characters with %(TABSIZE)d space characters.
11 In addition, all trailing space characters are removed.
12 usage: trim file ...
13 file ... : files are changed in place without taking any backup.
14 """ % vars()
15
16 def main():
17
18 if len(sys.argv) == 1:
19 sys.stderr.write(usage)
20 sys.exit(2)
21
22 # Iterate over the lines of all files listed in sys.argv[1:]
23 for line in fileinput.input(sys.argv[1:], inplace=True):
24 line = line.replace('\t',' '*TABSIZE); # replace TABs
25 line = line.rstrip(None) # remove trailing whitespaces
26 print line # modify the file
27
28 if __name__ == '__main__':
29 main()
OLDNEW
« no previous file with comments | « tools/refactoring/stringmanipulation.py ('k') | tools/refactoring/trimall.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698