Files
WCTDataMiner/docs/architecture/CLI命令设计.md
Scottxjw 2b031995e1 docs: 更新项目架构与数据模型文档
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-13 15:01:32 +08:00

110 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CLI 命令设计
> 所属模块:[架构概览](./概览.md)
---
## 1. 命令概览
| 命令 | 说明 | 数据流 |
|------|------|--------|
| `parse` | 解析日志文件到本地库 | log → local.db |
| `aggregate` | 从本地库汇总生成发布库 | local.db → release.db |
| `export` | 导出发布库到 CSV | release.db → CSV |
| `stats` | 查询本地库统计信息 | 只读 local.db |
| `clean` | 清理本地库数据(软删除) | 只写 local.db |
---
## 2. 命令详解
### 2.1 parse
```bash
# 解析单个文件
dotnet run parse --file path/to/log.txt
# 解析目录下所有文件
dotnet run parse --dir path/to/logs/
# 解析目录(递归)
dotnet run parse --dir path/to/logs/ --recursive
# 强制重新解析
dotnet run parse --file log.txt --force
```
### 2.2 aggregate
```bash
# 从 local.db 汇总生成 release.db默认重建
dotnet run aggregate
# 追加模式(不删除已有记录)
dotnet run aggregate --rebuild false
```
### 2.3 export
```bash
# 导出正式充电参数 CSV默认
dotnet run export --output ./data/output
# 导出正式充电参数 CSV + legacy Qfod/Ploss
dotnet run export --type all --output ./data/output
# 仅导出 legacy Qfod CSV
dotnet run export --type qfod --format csv
# 导出 JSON
dotnet run export --format json --type qfod
```
### 2.4 stats
```bash
# 查看整体统计
dotnet run stats --summary
# 按 FOD 类型统计
dotnet run stats --by-fod-type
# 按面板统计
dotnet run stats --by-panel
# 按硬件版本统计
dotnet run stats --by-hardware
# 按 RX 类型统计
dotnet run stats --by-rx-type
```
### 2.5 clean
```bash
# 清理指定场景
dotnet run clean --scenario <guid> --confirm
# 清理所有数据
dotnet run clean --all --confirm
```
---
## 3. 典型工作流
```bash
# 1. 解析日志
dotnet run parse --dir ./data/test_input --recursive
# 2. 查看统计
dotnet run stats --summary
# 3. 汇总生成发布库
dotnet run aggregate
# 4. 导出正式 CSV
dotnet run export --output ./data/output
```
输出文件: `./data/output/WCT-ChargingParameterDatabase.csv`