summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-01-27 00:33:44 +0800
committerruki <[email protected]>2018-01-26 21:22:28 +0800
commitaeae3a633365811cdc138b537942ef12e2218fd0 (patch)
tree07556ad6dc28bf63d26720655f78b0e5ea582473
parentb9e87ad535014f9f0b0e46af55311825985c735a (diff)
show help text
-rw-r--r--tests/ui/mconfdialog.lua5
-rw-r--r--xmake/core/ui/mconfdialog.lua24
2 files changed, 28 insertions, 1 deletions
diff --git a/tests/ui/mconfdialog.lua b/tests/ui/mconfdialog.lua
index 5e12c1050..c8c80945b 100644
--- a/tests/ui/mconfdialog.lua
+++ b/tests/ui/mconfdialog.lua
@@ -65,7 +65,10 @@ function demo:init()
local configs = {}
table.insert(configs, menuconf.boolean {description = "boolean config item"})
- table.insert(configs, menuconf.boolean {default = true, new = false, description = {"boolean config item2", "more"}})
+ table.insert(configs, menuconf.boolean {default = true, new = false, description = {"boolean config item2",
+ " - more description info",
+ " - more description info",
+ " - more description info"}})
table.insert(configs, menuconf.number {value = 6, default = 10, description = "number config item"})
table.insert(configs, menuconf.string {value = "x86_64", description = "string config item"})
table.insert(configs, menuconf.menu {description = "menu config item", configs = configs_sub})
diff --git a/xmake/core/ui/mconfdialog.lua b/xmake/core/ui/mconfdialog.lua
index de283135f..f23a81b3d 100644
--- a/xmake/core/ui/mconfdialog.lua
+++ b/xmake/core/ui/mconfdialog.lua
@@ -158,6 +158,30 @@ end
-- show help dialog
function mconfdialog:show_help()
if self:parent() then
+
+ -- get the current config item
+ local item = self:menuconf():current()
+
+ -- get the current config
+ local config = item:extra("config")
+
+ -- set help title
+ self:helpdialog():title():text_set(config:prompt())
+
+ -- set help text
+ local text = config.description
+ if type(text) == "table" then
+ text = table.concat(text, '\n')
+ end
+ if config.kind then
+ text = text .. "\ntype: " .. config.kind
+ end
+ if config.default then
+ text = text .. "\ndefault: " .. tostring(config.default)
+ end
+ self:helpdialog():text():text_set(text)
+
+ -- show help
self:parent():insert(self:helpdialog())
end
end