diff options
| author | ruki <[email protected]> | 2021-04-21 00:41:35 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-04-21 00:41:35 +0800 |
| commit | 09f860d3a05dea335000edc37371796c00749f98 (patch) | |
| tree | 238d24861e3d8e4260026c91f351528dc64139a7 | |
| parent | d8f8d6c465bd7e522549943d18898fb806fe52a6 (diff) | |
improve prompt
| -rw-r--r-- | xmake/modules/private/xrepo/action/env.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/xmake/modules/private/xrepo/action/env.lua b/xmake/modules/private/xrepo/action/env.lua index 019bbc59b..a1cf20506 100644 --- a/xmake/modules/private/xrepo/action/env.lua +++ b/xmake/modules/private/xrepo/action/env.lua @@ -240,7 +240,15 @@ function _run_shell(envs) local args = table.join({"-c", "'function prompt { \\\"[" .. projectname .. "] \\\" + $(Get-Location) + \\\"> \\\" }'"}, option.get("arguments")) os.execv("pwsh", args, {envs = envs}) elseif shell:endswith("sh") then - local prompt = "[" .. projectname .. "] " .. (os.getenv("PS1") or "> ") + local prompt = "[" .. projectname .. "] " + local ps1 = os.getenv("PS1") + if ps1 then + prompt = prompt .. ps1 + elseif is_host("macosx") then + prompt = prompt .. "\\W > " + else + prompt = prompt .. "> " + end os.execv(shell, option.get("arguments"), {envs = table.join({PS1 = prompt}, envs)}) elseif shell == "powershell" then local args = table.join({"-c", "'function prompt { \\\"[" .. projectname .. "] \\\" + $(Get-Location) + \\\"> \\\" }'"}, option.get("arguments")) |
