aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-11-24 20:12:22 +0100
committerKim Alvefur <zash@zash.se>2021-11-24 20:12:22 +0100
commit6e91f0ad43d4b429274ba035a149b4a4493ae4ba (patch)
tree49ecee1e792611b009d39a930e826cb6ae22fe89
parent1ac4aed7cde1aec722542199e488bc537423adbf (diff)
downloadprosody-6e91f0ad43d4b429274ba035a149b4a4493ae4ba.tar.gz
prosody-6e91f0ad43d4b429274ba035a149b4a4493ae4ba.zip
mod_admin_shell: Factor out simple function in module:info for reuse
Marginal improvement in readability
-rw-r--r--plugins/mod_admin_shell.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua
index ab7fbb70..9b7386b8 100644
--- a/plugins/mod_admin_shell.lua
+++ b/plugins/mod_admin_shell.lua
@@ -426,6 +426,8 @@ function def_env.module:info(name, hosts)
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 @@ function def_env.module:info(name, hosts)
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));