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.
 
 
 
 
 

26 lines
928 B

# -*- coding: utf-8 -*-
"""列出 Bruno 集合中商机详情子域/方案卡相关的 .bru(钥匙 + 所在页面文件夹)。"""
import io
import os
import re
import sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
DOCS = r'D:\code\crm-api-docs\商机模块'
pat = re.compile(r'`(GET|POST) ([^`]+)`')
rows = []
for dp, dn, fn in os.walk(DOCS):
rel = os.path.relpath(dp, DOCS)
for f in sorted(fn):
if not f.endswith('.bru') or f == 'folder.bru':
continue
txt = open(os.path.join(dp, f), encoding='utf-8').read()
m = pat.search(txt)
if m and re.search(r'/follow|/site-survey|/attachment|/oplog|/team|/customer|scheme-card', m.group(2), re.I):
rows.append((rel.replace('.', chr(92)), f, m.group(1) + ' ' + m.group(2)))
for rel, f, key in rows:
print('%-30s | %-22s | %s' % (rel, f, key))
print()
print('命中文件数:', len(rows))