feature: add cli rules

This commit is contained in:
Tyr Chen
2025-05-31 13:40:51 -07:00
parent 54952f38df
commit 606628b977
4 changed files with 1166 additions and 5 deletions

16
specs/instructions.md Normal file
View File

@@ -0,0 +1,16 @@
# Instructions
请构建 Rust CLI 项目的 rules:
1. 如果项目需要使用到 CLI则引入 clap使用 derive feature。
2. 如果有多个 CLI请使用 subcommand。
3. 构建应用于 command 的 execute trait每个 subcommand 实现该 trait并使用 enum_dispatch 进行 dispatch
```rust
#[enum_dispatch(...)]
pub trait CommandExecutor {
async fn execute(&self, args: &Args) -> Result<(), Error>;
}
```
4. 其他请遵循 clap 最佳实践