# HG changeset patch # User Kim Alvefur # Date 1623513997 -7200 # Node ID 03eb4c0dca27a51e887dca145e16e8a7a7eaa05a # Parent 0b65d43f4da4dbb4c8ae9c25e41a22de8313c0d3 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. diff -r 0b65d43f4da4 -r 03eb4c0dca27 plugins/mod_admin_shell.lua --- a/plugins/mod_admin_shell.lua Sat Jun 12 18:06:13 2021 +0200 +++ b/plugins/mod_admin_shell.lua Sat Jun 12 18:06:37 2021 +0200 @@ -410,6 +410,14 @@ ["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 @@ 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