From 6822ab9f3e310297414416b294f4ce7d1f6a8633 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E8=88=AA=E5=AE=87?= <3364451258@qq.com> Date: Fri, 29 May 2026 08:17:35 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=9E=B6=E6=9E=84=E5=9B=BE=E8=A1=A5?= =?UTF-8?q?=E5=85=85=20CLI=20=E6=B5=81=E7=A8=8B=20=E2=80=94=20=E6=80=BB?= =?UTF-8?q?=E8=A7=88=E5=9B=BE=E5=8A=A0=20clap/=E5=8E=9F=E5=AD=90=E6=80=A7?= =?UTF-8?q?=20+=20=E6=96=B0=E5=A2=9E=20CLI=20=E6=93=8D=E4=BD=9C=E6=97=B6?= =?UTF-8?q?=E5=BA=8F=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 --- README.md | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 063c7f6..69336db 100644 --- a/README.md +++ b/README.md @@ -35,15 +35,21 @@ graph TB Store --> Core end + subgraph CLI["CLI 命令行"] + Clap[clap 参数解析
17 条命令] + Atomic[原子性保护
verify_and_save] + end + subgraph IPC["Tauri IPC 桥接"] invoke[invoke / plugin-dialog] end - subgraph 后端["Rust 后端"] + subgraph 后端["Rust core 库"] Registry[注册表读写
HKLM / HKCU] System[系统操作
权限检测 / 路径验证 / 环境变量展开] - Files[文件操作
备份 / 配置 / 导入读取] + Files[文件操作
备份 / 配置 / 导入导出] Scanner[分析引擎
冲突检测 / 工具清单] + Profiles[配置管理
save/load/apply/rename] end subgraph Windows["Windows 系统"] @@ -56,10 +62,18 @@ graph TB invoke --> System invoke --> Files invoke --> Scanner + invoke --> Profiles + Clap --> Atomic + Atomic --> Registry + Atomic --> System + Atomic --> Files + Atomic --> Scanner + Atomic --> Profiles Registry --> Reg System --> FS Scanner --> FS Files --> FS + Profiles --> FS ``` ### 组件树 @@ -109,6 +123,30 @@ sequenceDiagram Z->>UI: isModified → false, statusMessage → '保存成功' ``` +### CLI 操作流程 + +```mermaid +sequenceDiagram + actor U as 用户 + participant CLI as patheditor-cli + participant Core as Rust core 库 + participant Win as Windows + + U->>CLI: patheditor add "D:\Tools" --system + CLI->>Core: load_system_paths() → 旧列表 + CLI->>CLI: 执行操作 (push / splice / clean) + CLI->>Core: load_system_paths() → 重新读取 + alt 注册表未修改 + CLI->>Core: save_system_paths(new_list) + Core->>Win: RegSetValueEx() + CLI->>Core: broadcast_env_change() + Core->>Win: SendMessageTimeout(WM_SETTINGCHANGE) + CLI-->>U: 已添加到系统 PATH + else 注册表已被其他进程修改 + CLI-->>U: 错误: 注册表已被其他进程修改 + end +``` + ## CLI 命令行 ```bash