summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-09-13 23:13:00 +0800
committerGitHub <[email protected]>2025-09-13 23:13:00 +0800
commita8ac81886afa4c174b76016a8e49016eae86ffa8 (patch)
treec7fe11e3f9957efdc87e294f6f52b6edb3011604
parent8069f629429c9db558b5bff6274358535be3043b (diff)
parente50f21b7a0202cf5d9ea4e1e09abfd6ac6c6f631 (diff)
Merge pull request #6800 from star-hengxing/nu
Support nushell for xrepo env
-rw-r--r--xmake/modules/private/xrepo/action/env.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/xmake/modules/private/xrepo/action/env.lua b/xmake/modules/private/xrepo/action/env.lua
index e116847b2..0c77e68a3 100644
--- a/xmake/modules/private/xrepo/action/env.lua
+++ b/xmake/modules/private/xrepo/action/env.lua
@@ -380,8 +380,14 @@ end
-- run shell
function _run_shell(envs)
local shell = os.shell()
+ local args = table.wrap(option.get("arguments"))
if shell == "pwsh" or shell == "powershell" then
- os.execv("pwsh", option.get("arguments"), {envs = envs})
+ os.execv("pwsh", args, {envs = envs})
+ elseif shell == "nu" then
+ if #args ~=0 then
+ table.insert(args, 1, "-c")
+ end
+ os.execv("nu", args, {envs = envs})
elseif shell:endswith("sh") then
local prompt = _get_prompt()
local ps1 = os.getenv("PS1")
@@ -392,11 +398,11 @@ function _run_shell(envs)
else
prompt = prompt .. " > "
end
- os.execv(shell, option.get("arguments"), {envs = table.join({PS1 = prompt}, envs)})
+ os.execv(shell, args, {envs = table.join({PS1 = prompt}, envs)})
elseif shell == "cmd" or is_host("windows") then
local prompt = _get_prompt()
prompt = prompt .. " $P$G"
- local args = table.join({"/k", "set PROMPT=" .. prompt}, option.get("arguments"))
+ local args = table.join({"/k", "set PROMPT=" .. prompt}, args)
os.execv("cmd", args, {envs = envs})
else
assert("shell not found!")