diff --git a/scripts/tui.py b/scripts/tui.py index c10f244..1bdf934 100644 --- a/scripts/tui.py +++ b/scripts/tui.py @@ -597,21 +597,24 @@ def dirs_menu() -> None: def backup_now() -> None: - """菜单 13: 一键备份 (相册/文档/下载/聊天记录)""" + """菜单 13: 一键备份 (相册/文档/下载/聊天记录/指定目录)""" print("--- 一键备份 ---") - print(" 备份项: photos (相册) / documents (文档) / download (下载) / chat (聊天记录)") - print(" 源目录在 config.json 的 backup 段配置, 增量备份只传新文件") - names = _clean(input(" 备份项 (回车=全部): ").strip()) - if names: - run(["backup.py"] + names.split()) - else: + print(" 预设项: photos (相册) / documents (文档) / download (下载) / chat (聊天记录)") + print(" 或直接输入目录路径备份指定目录 (如 /home/lou/图片), 回车=全部") + val = _clean(input(" 备份项或目录 (回车=全部): ").strip()) + if not val: run(["backup.py"]) + elif os.path.isdir(os.path.expanduser(val)): + run(["backup.py", "--dir", val]) + else: + run(["backup.py"] + val.split()) def restore_backup() -> None: """菜单 14: 恢复备份""" print("--- 恢复备份 ---") - name = _clean(input(" 备份项 (photos/documents/download/chat): ").strip()) + print(" 备份项: photos/documents/download/chat 或自定义目录名 (--dir 备份的)") + name = _clean(input(" 备份项: ").strip()) if not name: print("[提示] 已取消") return