summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-10-29 00:29:07 +0800
committerruki <[email protected]>2020-10-29 00:29:07 +0800
commite2e1045005affdac1c9bae2e66feeaed280022f9 (patch)
tree2acc575ba732b9612491b2e0ee9b71a2b5638133
parent7f2e9fb7f3bac208d0c7bc58fcf4b3ec5de91fac (diff)
improve xrepo/env
-rw-r--r--xmake/modules/private/xrepo/action/env.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/xmake/modules/private/xrepo/action/env.lua b/xmake/modules/private/xrepo/action/env.lua
index 2b49e6172..ecdacad8f 100644
--- a/xmake/modules/private/xrepo/action/env.lua
+++ b/xmake/modules/private/xrepo/action/env.lua
@@ -38,17 +38,21 @@ function menu_options()
{'a', "arch", "kv", nil, "Set the given architecture." },
{'m', "mode", "kv", nil, "Set the given mode.",
values = {"release", "debug"} },
+ {nil, "show", "k", nil, "Only show environment information." },
{'f', "configs", "kv", nil, "Set the given extra package configs.",
"e.g.",
" - xrepo env -f \"vs_runtime=MD\" zlib cmake ..",
" - xrepo env -f \"regex=true,thread=true\" \"zlib,boost\" cmake .."},
+ {'b', "packages", "kv", nil, "Set the packages to be bound",
+ "e.g.",
+ " - xrepo env -b \"python 3.x\" python",
+ " - xrepo env -p android -b \"zlib,luajit 2.x\" luajit xx.lua"},
{},
- {nil, "packages", "v", nil, "Set the packages to be bound" },
- {nil, "program", "v", nil, "Set the program name to be run",
+ {nil, "program", "v", nil, "Set the program name to be run",
"e.g.",
" - xrepo env",
- " - xrepo env \"python 3.x\" python",
- " - xrepo env -p android \"zlib,luajit 2.x\" luajit xx.lua"},
+ " - xrepo env python",
+ " - xrepo env -p android luajit xx.lua"},
{nil, "arguments", "vs", nil, "Set the program arguments to be run"}
}
@@ -201,7 +205,7 @@ end
-- get package environments
function _package_getenvs()
local envs = os.getenvs()
- local packages = option.get("packages")
+ local packages = option.get("packages") or option.get("program")
if packages then
_enter_project()
packages = packages:split(',', {plain = true})
@@ -217,7 +221,7 @@ end
function main()
local envs = _package_getenvs()
local program = option.get("program")
- if program then
+ if program and not option.get("show") then
if envs and envs.PATH then
os.setenv("PATH", envs.PATH)
end