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

Function process_files

utils/update_version.py:20–33  ·  view source on GitHub ↗
(file_path)

Source from the content-addressed store, hash-verified

18
19
20def process_files(file_path):
21 with open(file_path, 'r', encoding='utf-8') as file:
22 content = file.read()
23 version_match = re.search(r'(//\s*@version)(\s+)(\S+)', content)
24 if version_match:
25 spaces = version_match.group(2) # 匹配中间的空格数
26 old_version = version_match.group(3) # 匹配旧版本号
27 updated_line, version_str = make_version_line(old_version, spaces)
28 print(f"{file_path}:{old_version} (old)")
29 print(f"{file_path}:{version_str} (new)")
30 updated_content = content.replace(version_match.group(0), updated_line)
31 with open(file_path, 'w', encoding='utf-8', newline='\n') as file:
32 file.write(updated_content)
33 return version_str
34
35
36def list_userjs():

Callers 1

update_version.pyFile · 0.85

Calls 1

make_version_lineFunction · 0.85

Tested by

no test coverage detected