- 移除 anyhow,使用 thiserror 定义强类型 Error 枚举 - 支持 #[from] 自动转换 mlua::Error,关键路径保留源码与上下文 - LuaRuntimeBuilder 采用惰性错误收集,简化链式初始化调用 - MirrorRegistry 实现规范化 FromLuaConversionError 错误转换
27 lines
740 B
Lua
27 lines
740 B
Lua
-- commands/commands.lua
|
|
|
|
return {
|
|
-- 1. 单文件子命令 (commands/use.lua)
|
|
["use"] = {
|
|
description = "Switch the active version of a tool",
|
|
module = mr.command("use")
|
|
},
|
|
|
|
-- 2. 单文件子命令 (commands/list.lua)
|
|
["list"] = {
|
|
description = "List available and currently activated versions",
|
|
module = mr.command("list")
|
|
},
|
|
|
|
-- 3. 复杂多文件子命令 (加载 commands/log/init.lua)
|
|
["log"] = {
|
|
description = "View or configure mirror runtime logs",
|
|
module = mr.command("log")
|
|
},
|
|
|
|
-- 4. 支持别名快捷映射 (例如 mr ls 等价于 mr list)
|
|
["ls"] = {
|
|
description = "Alias for list",
|
|
module = mr.command("list")
|
|
}
|
|
} |