summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-02-03 00:42:26 +0800
committerruki <[email protected]>2018-02-02 22:14:40 +0800
commit63ecc9139b29a21c0c812e9dca64dbdee2e5e725 (patch)
tree1bd0ae6bcb2cf411afd9da335adb9145ce2f7da3
parent22e4a987e03ee6884da0b2cbb8a23397e7f17931 (diff)
improve choice help menu
-rw-r--r--xmake/actions/config/xmake.lua19
-rw-r--r--xmake/core/base/option.lua20
-rw-r--r--xmake/core/ui/mconfdialog.lua6
3 files changed, 26 insertions, 19 deletions
diff --git a/xmake/actions/config/xmake.lua b/xmake/actions/config/xmake.lua
index 5641d0624..3eee423b7 100644
--- a/xmake/actions/config/xmake.lua
+++ b/xmake/actions/config/xmake.lua
@@ -53,22 +53,6 @@ task("config")
, {category = "."}
, {'p', "plat", "kv", "$(host)", "Compile for the given platform."
-
- -- show the description of all platforms
- , function ()
-
- -- import platform
- import("core.platform.platform")
-
- -- make description
- local description = {}
- for i, plat in ipairs(platform.plats()) do
- description[i] = " - " .. plat
- end
-
- -- get it
- return description
- end
, values = function ()
return import("core.platform.platform").plats()
end }
@@ -100,9 +84,6 @@ task("config")
, " - release"
, " - ... (custom)" }
, {'k', "kind", "kv", "static", "Compile for the given target kind."
- , " - static"
- , " - shared"
- , " - binary"
, values = function ()
return {"static", "shared", "binary"}
end }
diff --git a/xmake/core/base/option.lua b/xmake/core/base/option.lua
index 4037e6331..a6a87ad7c 100644
--- a/xmake/core/base/option.lua
+++ b/xmake/core/base/option.lua
@@ -1108,6 +1108,26 @@ function option.show_options(options)
end
end
end
+
+ -- print values
+ local values = opt.values
+ if type(values) == "function" then
+ values = values()
+ end
+ if values then
+
+ for _, value in ipairs(table.wrap(values)) do
+
+ -- make spaces
+ local spaces = ""
+ for i = 0, padding do
+ spaces = spaces .. " "
+ end
+
+ -- print this value
+ print(option._inwidth_append(spaces, " - " .. tostring(value), padding + 1, console_width))
+ end
+ end
end
end
diff --git a/xmake/core/ui/mconfdialog.lua b/xmake/core/ui/mconfdialog.lua
index 4f0fb5283..5c1941f36 100644
--- a/xmake/core/ui/mconfdialog.lua
+++ b/xmake/core/ui/mconfdialog.lua
@@ -204,6 +204,12 @@ function mconfdialog:show_help()
if config.default then
text = text .. "\ndefault: " .. tostring(config.default)
end
+ if config.kind == "choice" then
+ text = text .. "\nvalues: "
+ for _, value in ipairs(config.values) do
+ text = text .. "\n - " .. value
+ end
+ end
self:helpdialog():text():text_set(text)
-- show help