-- commands/commands.lua function command(mod_path) -- 无论输入 "a/b/c" 还是 "a\b\c",统一替换为标准的 "a.b.c" local normalized = mod_path:gsub("[/\\]", ".") return { __is_lazy_command = true, module = normalized } end return { -- 1. 单文件子命令 (commands/use.lua) ["use"] = { description = "Switch the active version of a tool", handler = command("use") }, -- 2. 单文件子命令 (commands/list.lua) ["list"] = { description = "List available and currently activated versions", handler = command("list") }, -- 3. 复杂多文件子命令 (加载 commands/log/init.lua) ["log"] = { description = "View or configure mirror runtime logs", handler = command("log") }, -- 4. 支持别名快捷映射 (例如 mr ls 等价于 mr list) ["ls"] = { description = "Alias for list", handler = command("list") } }