MCPcopy
hub / github.com/ChinaGodMan/UserScripts / check_related_readme

Function check_related_readme

utils/update_related_all_scripts.py:9–23  ·  view source on GitHub ↗
(file_path, related_scripts_map)

Source from the content-addressed store, hash-verified

7
8# 获取readme文件中相关脚本分组
9def check_related_readme(file_path, related_scripts_map):
10 not_in_scriptspath = []
11 try:
12 with open(file_path, 'r', encoding='utf-8') as file:
13 content = file.read()
14 # 匹配 <!--RELATED- -END-->标签
15 matches = re.findall(r'<!--RELATED-([a-zA-Z0-9\-一-龥]+)-END-->', content)
16 if matches:
17 for group in matches:
18 if re.search(r'[\u4e00-\u9fa5]', group):
19 if group not in related_scripts_map:
20 not_in_scriptspath.append(group)
21 except Exception as e:
22 print(f"读取文件 {file_path} 时出错: {e}")
23 return not_in_scriptspath
24
25
26# 删除readme文件中不存在的相关脚本分组

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected