1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! SZ-Rust CLI — 命令行工具
//!
//! Phase 8 交付物,替代 PHP `think` 命令,借鉴 Laravel Artisan 风格。
//!
//! ## PHP 对齐
//!
//! 本包对齐 PHP ThinkPHP 6 `think` 命令体系:
//!
//! - `php think make:model` → `sz-rust make:model`
//! - `php think make:controller` → `sz-rust make:controller`
//! - `php think make:migration` → `sz-rust make:migration`(Phinx 风格)
//! - `php think migrate` → `sz-rust migrate`
//! - `php think migrate:status` → `sz-rust migrate:status`
//! - `php think route:list` → `sz-rust route:list`
//! - `php think cache:clear` → `sz-rust cache:clear`
//!
//! ## 模块结构
//!
//! | 模块 | 功能 |
//! |------|------|
//! | `cli` | clap 命令定义(Cli / Commands / Options) |
//! | `cmd::make` | make:* 代码生成命令 |
//! | `cmd::migrate` | migrate / migrate:status 迁移命令 |
//! | `cmd::route` | route:list 路由列表命令 |
//! | `cmd::cache` | cache:clear 缓存清理命令 |
//! | `cmd::scheduler` | scheduler:* 调度器命令(Phase 8.11-8.14) |
//! | `error` | CLI 错误类型 |
//! | `stubs` | 代码生成模板(对齐 PHP make/stubs) |
//!
//! ## R5 硬约束
//!
//! - R5-48:`make:model` 生成 Model 骨架代码对齐 PHP `think\console\command\make\Model`
//! - R5-49:`make:controller` 生成 Controller 骨架代码对齐 PHP `think\console\command\make\Controller`
//! - R5-50:`migrate:status` 显示迁移进度对齐 PHP `think migrate:status`
//! - R5-51:`cache:clear` 清空缓存对齐 PHP `think cache:clear`
pub use ;
pub use CliError;
/// 运行 CLI(入口函数)
///
/// 解析命令行参数并执行对应命令,返回退出码。
///
/// # 参数
///
/// - `args`:命令行参数(含程序名,如 `["sz-rust", "make", "model", "User"]`)
///
/// # 返回
///
/// - `Ok(0)`:成功
/// - `Ok(code)`:命令指定的退出码
/// - `Err(_)`:内部错误