pub enum Command {
Show 16 variants
Make {
make_command: MakeCommand,
},
Migrate {
args: MigrateArgs,
},
MigrateStatus {
path: String,
db_type: String,
show_sql: bool,
url: Option<String>,
},
RouteList {
format: String,
},
CacheClear {
store: Option<String>,
},
Seed {
path: String,
db_type: String,
show_sql: bool,
url: Option<String>,
class: Option<String>,
},
Scheduler {
scheduler_command: SchedulerCommand,
},
OptimizeRoute,
OptimizeConfig,
OptimizeSchema,
RouteClear,
Plugin {
plugin_command: PluginCommand,
},
Admin {
admin_command: AdminCommand,
},
Serve {
with_admin: bool,
with_tenant: bool,
with_data_scope: bool,
addr: String,
watch_config: bool,
workers: Option<u16>,
grace_timeout: Option<u16>,
tls_cert: Option<PathBuf>,
tls_key: Option<PathBuf>,
access_log: bool,
health: bool,
no_health: bool,
},
ServeReload,
ServeLogLevel,
}Expand description
顶层命令枚举
对齐 PHP think 的命令分组(make / migrate / route / cache)。
Variants§
Make
代码生成命令组(make:migration / make:model / make:controller / make:guard / make:scaffold)
Fields
make_command: MakeCommandmake 子命令
Migrate
数据库迁移命令(migrate / migrate:status / migrate:rollback)
Fields
args: MigrateArgs迁移子命令参数
MigrateStatus
迁移状态查询(对齐 PHP php think migrate:status)
Fields
RouteList
路由列表(对齐 PHP php think route:list)
CacheClear
清空缓存(对齐 PHP php think cache:clear)
Seed
数据填充(对齐 PHP php think db:seed)
从 seeds/ 目录加载 .sql 文件并执行。提供 --url 时连接数据库真实执行,
否则为离线模式(仅打印待执行内容)。
Fields
Scheduler
调度器命令组(scheduler:list / scheduler:run / scheduler:start)
Fields
scheduler_command: SchedulerCommandscheduler 子命令
OptimizeRoute
生成路由缓存(对齐 PHP php think optimize:route)
收集路由元数据,序列化为 JSON 写入 runtime/cache/route_cache.json。
OptimizeConfig
生成配置缓存(对齐 PHP php think optimize:config)
扫描 config/ 目录,合并所有配置,序列化为 JSON 写入 runtime/cache/config_cache.json。
OptimizeSchema
生成数据表字段缓存(对齐 PHP php think optimize:schema)
读取 config/database.yml 数据库连接配置,生成 schema 缓存索引文件
(runtime/schema_cache.json + runtime/schema_cache.php)。
业务方运行时通过 SchemaCache::remember_schema() 填充具体字段信息。
RouteClear
清除路由缓存(对齐 PHP php think route:clear)
删除 runtime/cache/route_cache.json 文件。
Plugin
插件市场命令组(plugin search/install/publish/uninstall/update/list/login)
Fields
plugin_command: PluginCommandplugin 子命令
Admin
Admin 后台管理插件命令组(admin migrate/list-routes/list-capabilities/init)
Fields
admin_command: AdminCommandadmin 子命令
Serve
启动 HTTP 服务(对齐 PHP php think run)
Fields
ServeReload
触发运行中的 serve 进程重载配置(Windows 替代 SIGUSR1/SIGHUP)
Unix 平台建议使用 kill -USR1 <pid> 或 kill -HUP <pid>。
首版仅输出提示信息,完整实现需后续版本支持。
ServeLogLevel
触发运行中的 serve 进程切换日志级别(Windows 替代 SIGUSR2)
Unix 平台建议使用 kill -USR2 <pid>。
首版仅输出提示信息,完整实现需后续版本支持。
Trait Implementations§
Source§impl FromArgMatches for Command
impl FromArgMatches for Command
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§fn update_from_arg_matches_mut<'b>(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§impl Subcommand for Command
impl Subcommand for Command
Source§fn augment_subcommands<'b>(__clap_app: Command) -> Command
fn augment_subcommands<'b>(__clap_app: Command) -> Command
Source§fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command
fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command
Command so it can instantiate self via
FromArgMatches::update_from_arg_matches_mut Read moreSource§fn has_subcommand(__clap_name: &str) -> bool
fn has_subcommand(__clap_name: &str) -> bool
Self can parse a specific subcommandAuto Trait Implementations§
impl Freeze for Command
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnsafeUnpin for Command
impl UnwindSafe for Command
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.