diff options
| -rw-r--r-- | tests/ui/mconfdialog.lua | 5 | ||||
| -rw-r--r-- | xmake/core/ui/mconfdialog.lua | 24 |
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 |
