mods that hopefully work for a TechAge-based pack

This commit is contained in:
2026-09-09 06:27:51 -06:00
parent 4e6b08d194
commit c27db2a537
6234 changed files with 375578 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env python2
# -*- coding: iso-8859-1 -*-
import os
import re
import sys
def grep(pattern, path='./', endings=['.lua']):
"""
Search in all files with the ending 'endings' in the given 'path'
for the given text 'pattern'.
"""
lOut = []
for dirpath, dirnames, filenames in os.walk(path):
for name in filenames:
_, ext = os.path.splitext(name)
if ext in endings:
filename = os.path.join(dirpath, name)
i = 0
## line oriented approach
for line in file(filename).readlines():
i = i + 1
match = re.search(pattern, line) # search pattern in line
if match:
print filename + ' [' + str(i) + '] ' + line.strip()
return lOut
if __name__ == '__main__':
grep(sys.argv[1])