improve mconfdialog

This commit is contained in:
ruki
2020-11-14 11:08:37 +08:00
parent fa71648eb8
commit 987b002e0d
2 changed files with 6 additions and 4 deletions

View File

@@ -252,14 +252,16 @@ function mconfdialog:show_help()
if config.kind then
text = text .. "\ntype: " .. config.kind
end
if config.default then
text = text .. "\ndefault: " .. tostring(config.default)
end
if config.kind == "choice" then
if config.default and config.values[config.default] then
text = text .. "\ndefault: " .. config.values[config.default]
end
text = text .. "\nvalues: "
for _, value in ipairs(config.values) do
text = text .. "\n - " .. value
end
elseif config.default then
text = text .. "\ndefault: " .. tostring(config.default)
end
if config.path then
text = text .. "\npath: " .. config.path

View File

@@ -69,7 +69,7 @@ function demo:init()
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})
table.insert(configs, menuconf.choice {value = 3, values = {1, 5, 6, 7}, description = "choice config item"})
table.insert(configs, menuconf.choice {value = 3, values = {1, 5, 6, 7}, default = 2, description = "choice config item"})
-- init menu config dialog
self:dialog_mconf():load(configs)