mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-09-10 04:41:57 -04:00
Script to add emacs mode line to all files
This commit is contained in:
parent
7b51917592
commit
f327450dd5
16
scripts/modeline.py
Normal file
16
scripts/modeline.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
modline = "// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-\n\n"
|
||||||
|
|
||||||
|
for path in sys.argv[1:]:
|
||||||
|
lines = [modline]
|
||||||
|
with file(path) as f:
|
||||||
|
lines += f.readlines()
|
||||||
|
|
||||||
|
has_modeline = any([l for l in lines[1:] if l.find('Mode: c++') != -1])
|
||||||
|
if has_modeline:
|
||||||
|
continue
|
||||||
|
|
||||||
|
with file(path, 'w') as f:
|
||||||
|
for line in lines:
|
||||||
|
f.write(line)
|
Loading…
x
Reference in New Issue
Block a user