mod_admin_shell: module:info: Show friendlier name for known 'items'
authorKim Alvefur <zash@zash.se>
Sat, 12 Jun 2021 18:06:13 +0200
changeset 11610 0b65d43f4da4
parent 11609 225ef07f2bee
child 11611 03eb4c0dca27
mod_admin_shell: module:info: Show friendlier name for known 'items'
plugins/mod_admin_shell.lua
--- a/plugins/mod_admin_shell.lua	Sat Jun 12 17:49:44 2021 +0200
+++ b/plugins/mod_admin_shell.lua	Sat Jun 12 18:06:13 2021 +0200
@@ -403,6 +403,13 @@
 		return false, "mod_" .. name .. " does not appear to be loaded on the specified hosts";
 	end
 
+	local friendly_descriptions = {
+		["adhoc-provider"] = "Ad-hoc commands",
+		["auth-provider"] = "Authentication provider",
+		["http-provider"] = "HTTP services",
+		["net-provider"] = "Network service",
+		["storage-provider"] = "Storage driver",
+	};
 	for host in hosts do
 		local mod = modulemanager.get_module(host, name);
 		if mod.module.host == "*" then
@@ -417,7 +424,8 @@
 		if mod.module.items and next(mod.module.items) ~= nil then
 			print("  provides:");
 			for kind, items in pairs(mod.module.items) do
-				print(string.format("  - %s (%d item%s)", kind, #items, #items > 1 and "s" or ""));
+				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 ""));
 			end
 		end
 		if mod.module.dependencies and next(mod.module.dependencies) ~= nil then