refactor(mirror),feat(runtime): 支持在 mirror.lua 中通过 tools_dir 设置自定义目录;优化参数解析与 Command 构建逻辑
- 新增 Lua 动态配置 tools 目录并返回完整路径 - 将 `resolve_args` 和 `to_command` 改为接受泛型 `IntoIterator`,解耦参数来源 - 统一使用 `chain` 零拷贝合并预设参数与运行时参数,消除多余堆分配 - 提权回退分支改为直接复用 `cmd.get_args()`,修复提权时 `mr:` 别名未展开的缺陷 - 规范参数与变量命名,完善代码注释
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
-- mirror.lua (总控制台)
|
||||
-- __SHIM_DIR__ 已经在 Rust 中注入完毕,并且是正斜杠格式 (例如 C:/Tools)
|
||||
local base_dir = __SHIM_DIR__
|
||||
-- __MIRROR_DIR__ 已经在 Rust 中注入完毕,并且是正斜杠格式 (例如 C:/Tools)
|
||||
local base_dir = __MIRROR_DIR__
|
||||
|
||||
-- 1. 自定义局部变量,方便复用与后续维护
|
||||
local python_home = base_dir .. "/tools/python39"
|
||||
@@ -13,12 +13,14 @@ return {
|
||||
target = base_dir .. "/tools/numa/numa.exe",
|
||||
-- 追加参数
|
||||
args = { "--help" },
|
||||
|
||||
aliases = {},
|
||||
-- 注入环境变量,使用 get_env 获取宿主机当前值
|
||||
env = {
|
||||
PATH = { base_dir .. "/tools/numa", get_env("PATH") }
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
["git"] = {
|
||||
target = base_dir .. "/git/bin/git.exe",
|
||||
-- 追加参数
|
||||
|
||||
Reference in New Issue
Block a user