diff options
author | Kim Alvefur <zash@zash.se> | 2021-06-12 18:06:37 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-06-12 18:06:37 +0200 |
commit | df48c1e8670e9e9a84fb4b9058116efe99ff91ec (patch) | |
tree | 4def458c4daf9863458bf5fd7925ed451f882b87 /plugins | |
parent | bd8d770411c9a50cd00caa9d9e11da2e06a55b7a (diff) | |
download | prosody-df48c1e8670e9e9a84fb4b9058116efe99ff91ec.tar.gz prosody-df48c1e8670e9e9a84fb4b9058116efe99ff91ec.zip |
mod_admin_shell: module:info: List 'items' that can be formatted easily
Some items like HTTP providers would be very verbose, others are tricky
to handle.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_admin_shell.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua index faa29f2d..3b1ce277 100644 --- a/plugins/mod_admin_shell.lua +++ b/plugins/mod_admin_shell.lua @@ -410,6 +410,14 @@ function def_env.module:info(name, hosts) ["net-provider"] = "Network service", ["storage-provider"] = "Storage driver", }; + 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, + }; + for host in hosts do local mod = modulemanager.get_module(host, name); if mod.module.host == "*" then @@ -426,6 +434,12 @@ function def_env.module:info(name, hosts) for kind, items in pairs(mod.module.items) do local label = friendly_descriptions[kind] or kind:gsub("%-", " "):gsub("^%a", string.upper); print(string.format(" - %s (%d item%s)", label, #items, #items > 1 and "s" or "")); + local formatter = item_formatters[kind]; + if formatter then + for _, item in ipairs(items) do + print(" - " .. formatter(item)); + end + end end end if mod.module.dependencies and next(mod.module.dependencies) ~= nil then |