diff options
| author | xq114 <[email protected]> | 2021-04-28 14:13:38 +0800 |
|---|---|---|
| committer | xq114 <[email protected]> | 2021-04-28 14:13:38 +0800 |
| commit | e98ca4f7d28c12fc1cfead20fd774e30eb7ff52a (patch) | |
| tree | e4a5ba95c20b18277b09e24b5391c9ccb71e642d /xmake/modules | |
| parent | 13b88deacc54b60a383ea9c3e3862851d533a042 (diff) | |
improve environment
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/private/xrepo/action/env.lua | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/xmake/modules/private/xrepo/action/env.lua b/xmake/modules/private/xrepo/action/env.lua index 59822420c..da573ffca 100644 --- a/xmake/modules/private/xrepo/action/env.lua +++ b/xmake/modules/private/xrepo/action/env.lua @@ -53,7 +53,6 @@ function menu_options() " - xrepo env -b \"llvm 11.x\" bash", " $ clang --version", " - xrepo env -p android -b \"zlib,luajit 2.x\" luajit xx.lua"}, - {nil, "info", "k", nil, "Get the information of the virtual environment."}, {}, {nil, "program", "v", nil, "Set the program name to be run", "e.g.", @@ -254,6 +253,16 @@ function _get_env_script(envs, shell) return ret end +-- get information of current virtual environment +function info(key) + if key == "prompt" then + print("[%s]", path.filename(os.projectdir())) + elseif key:startswith("script.") then + local shell = key:match("script%.(.+)") + print(_get_env_script(envs, shell)) + end +end + -- run shell function _run_shell(envs) local shell = os.shell() @@ -284,18 +293,7 @@ end function main() local envs = _package_getenvs() local program = option.get("program") - if option.get("info") then - if program then - if program == "prompt" then - print(format("[%s]", path.filename(os.projectdir()))) - elseif program:startswith("script.") then - local shell = program:match("script%.(.+)") - print(_get_env_script(envs, shell)) - end - else - return - end - elseif program and not option.get("show") then + if program and not option.get("show") then if envs and envs.PATH then os.setenv("PATH", envs.PATH) end |
