You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
757 B
20 lines
757 B
|
1 day ago
|
import sys, re
|
||
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
||
|
|
p = r'e:\code\crm-backend-matt\.scratch\customer-demo-ref\demo\index.html'
|
||
|
|
lines = open(p, encoding='utf-8').read().splitlines()
|
||
|
|
mode = sys.argv[1] if len(sys.argv) > 1 else 'func'
|
||
|
|
if mode == 'func':
|
||
|
|
for i, l in enumerate(lines, 1):
|
||
|
|
if i <= 705 and ('function ' in l or 'async ' in l):
|
||
|
|
print(i, l.rstrip()[:130])
|
||
|
|
elif mode == 'id':
|
||
|
|
lo, hi = int(sys.argv[2]), int(sys.argv[3])
|
||
|
|
for i, l in enumerate(lines, 1):
|
||
|
|
if lo <= i <= hi and re.search(r"id=[\"']", l):
|
||
|
|
print(i, l.strip()[:150])
|
||
|
|
elif mode == 'range':
|
||
|
|
lo, hi = int(sys.argv[2]), int(sys.argv[3])
|
||
|
|
for i, l in enumerate(lines, 1):
|
||
|
|
if lo <= i <= hi:
|
||
|
|
print(i, l.rstrip())
|