Follow the code style below
// comment
exports.youFunc = function(...){}
usage:
./tuneExports.py file1 file2 file3
find yourRepo -type f | xargs ./tuneExports.py
#!/usr/bin/python3 | |
import sys | |
import re | |
l_file = sys.argv[1:]; | |
for i in l_file: | |
f = open(i, 'r'); | |
log = open('API.txt', 'a+'); | |
log.write("File: " + i + "\n\n"); | |
lines = f.readlines(); | |
for j in range(0, len(lines)): | |
if re.match('.*exports\.', lines[j]): | |
if j>0 and re.match(r'//', lines[j-1]): | |
log.write(lines[j-1].strip()+ "\n" + lines[j].strip() + "\n\n") | |
else: | |
log.write("// FIXME: from " + i + "\n" + lines[j].strip() + "\n\n"); |