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

Function update_log

utils/update_version.py:48–54  ·  view source on GitHub ↗
(md_path, lines_to_add)

Source from the content-addressed store, hash-verified

46
47
48def update_log(md_path, lines_to_add):
49 with open(md_path, "r", encoding="utf-8") as f:
50 original_content = f.readlines()
51 # 在脚本名称后插入新的更新段.
52 updated_content = original_content[:1] + lines_to_add + original_content[1:]
53 with open(md_path, "w", encoding="utf-8", newline='\n') as f:
54 f.writelines("\n" + line + "\n" if not line.endswith("\n") else line for line in updated_content)
55
56
57if __name__ == "__main__":

Callers 1

update_version.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected