Files
WCTDataMiner/docs/architecture/CLI命令设计.md
Scottxjw f3472d21ee refactor: 移除 stats 统计功能
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-14 09:23:26 +08:00

87 lines
1.7 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 |
| `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 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 aggregate
# 3. 导出正式 CSV
dotnet run export --output ./data/output
```
输出文件: `./data/output/WCT-ChargingParameterDatabase.csv`