Rename the CLI crate and executable to cli

This commit is contained in:
2026-12-03 04:30:27 +08:00
parent 763b46f43e
commit c0b8a0f229
7 changed files with 16 additions and 16 deletions
+37
View File
@@ -0,0 +1,37 @@
# cli
可信操作员的 JSON 行命令入口。启动参数指定数据库文件,程序复用同一个 Exchange 连接。标准输入的每一行对应标准输出的一条 JSON 回执。输入结束时进程退出。
## 文件依赖
箭头从调用文件指向提供功能的文件或 crate。
```mermaid
flowchart LR
main["src/main.rs"] -->|把标准输入输出交给 serve| stream["src/stream.rs"]
main -.->|打开数据库| api["exchange crate"]
stream -.->|执行命令| api
```
## 一次命令会话
```mermaid
sequenceDiagram
actor U as 操作员
participant C as main.rs
participant S as stream.rs
participant E as Exchange
U->>C: 启动并指定数据库路径
C->>E: 打开数据库
C->>S: 传入连接和输入输出流
loop 输入一行
U->>S: JSON 命令
alt JSON 有效
S->>E: 执行命令
E-->>S: 业务回执或错误
else JSON 解析失败
S->>S: 构造错误回执
end
S-->>U: 输出一行 JSON 并刷新
end
```