Skip to content

Commit a8ac818

Browse files
authored
Merge pull request #6800 from star-hengxing/nu
Support nushell for xrepo env
2 parents 8069f62 + e50f21b commit a8ac818

File tree

1 file changed

+9
-3
lines changed
  • xmake/modules/private/xrepo/action

1 file changed

+9
-3
lines changed

xmake/modules/private/xrepo/action/env.lua

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,14 @@ end
380380
-- run shell
381381
function _run_shell(envs)
382382
local shell = os.shell()
383+
local args = table.wrap(option.get("arguments"))
383384
if shell == "pwsh" or shell == "powershell" then
384-
os.execv("pwsh", option.get("arguments"), {envs = envs})
385+
os.execv("pwsh", args, {envs = envs})
386+
elseif shell == "nu" then
387+
if #args ~=0 then
388+
table.insert(args, 1, "-c")
389+
end
390+
os.execv("nu", args, {envs = envs})
385391
elseif shell:endswith("sh") then
386392
local prompt = _get_prompt()
387393
local ps1 = os.getenv("PS1")
@@ -392,11 +398,11 @@ function _run_shell(envs)
392398
else
393399
prompt = prompt .. " > "
394400
end
395-
os.execv(shell, option.get("arguments"), {envs = table.join({PS1 = prompt}, envs)})
401+
os.execv(shell, args, {envs = table.join({PS1 = prompt}, envs)})
396402
elseif shell == "cmd" or is_host("windows") then
397403
local prompt = _get_prompt()
398404
prompt = prompt .. " $P$G"
399-
local args = table.join({"/k", "set PROMPT=" .. prompt}, option.get("arguments"))
405+
local args = table.join({"/k", "set PROMPT=" .. prompt}, args)
400406
os.execv("cmd", args, {envs = envs})
401407
else
402408
assert("shell not found!")

0 commit comments

Comments
 (0)