#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ 待办事项自动提醒脚本 系统启动时自动显示待办清单,防止遗忘 """ import os import sys def main(): todo_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "待执行迁移计划.md") if not os.path.exists(todo_file): print("[待办提醒] 待执行迁移计划.md 不存在,请创建。") return print() print("=" * 60) print(" ⚠️ 系统待办事项提醒(每次启动自动显示)") print("=" * 60) with open(todo_file, "r", encoding="utf-8") as f: lines = f.readlines() # 提取待办事项(未完成的 [ ] 项) todos = [] current_section = "" for line in lines: line = line.strip() if line.startswith("## "): current_section = line.replace("## ", "").strip() elif line.startswith("- [ ]"): todo = line.replace("- [ ]", "").strip() todos.append((current_section, todo)) if todos: print(f"\n 共 {len(todos)} 项待完成:\n") for i, (section, todo) in enumerate(todos, 1): print(f" {i}. [{section}] {todo}") else: print("\n ✅ 所有待办已完成!") print() print(" 详细内容请查看:待执行迁移计划.md") print("=" * 60) print() if __name__ == "__main__": main()