Software /
code /
prosody
Changeset
11932:92925f1320e7
mod_admin_shell: Factor out simple function in module:info for reuse
Marginal improvement in readability
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 24 Nov 2021 20:12:22 +0100 |
parents | 11931:c65d5da8e99a |
children | 11933:f752427a5214 |
files | plugins/mod_admin_shell.lua |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_admin_shell.lua Wed Nov 24 20:03:38 2021 +0100 +++ b/plugins/mod_admin_shell.lua Wed Nov 24 20:12:22 2021 +0100 @@ -426,6 +426,8 @@ return false, "mod_" .. name .. " does not appear to be loaded on the specified hosts"; end + local function item_name(item) return item.name; end + local friendly_descriptions = { ["adhoc-provider"] = "Ad-hoc commands", ["auth-provider"] = "Authentication provider", @@ -438,11 +440,11 @@ local item_formatters = { ["feature"] = tostring, ["identity"] = function(ident) return ident.type .. "/" .. ident.category; end, - ["adhoc-provider"] = function(item) return item.name; end, - ["auth-provider"] = function(item) return item.name; end, - ["storage-provider"] = function(item) return item.name; end, + ["adhoc-provider"] = item_name, + ["auth-provider"] = item_name, + ["storage-provider"] = item_name, ["http-provider"] = function(item, mod) return mod:http_url(item.name); end, - ["net-provider"] = function(item) return item.name; end, + ["net-provider"] = item_name, ["measure"] = function(item) return item.name .. " (" .. suf(item.conf and item.conf.unit, " ") .. item.type .. ")"; end, ["metric"] = function(item) return ("%s (%s%s)%s"):format(item.name, suf(item.mf.unit, " "), item.mf.type_, pre(": ", item.mf.description));