From df48c1e8670e9e9a84fb4b9058116efe99ff91ec Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 12 Jun 2021 18:06:37 +0200 Subject: 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. --- plugins/mod_admin_shell.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'plugins') 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 -- cgit v1.2.3