Diff

plugins/mod_admin_shell.lua @ 13117:7eb6244b4984

mod_admin_shell: Show internal URL where different from external
author Kim Alvefur <zash@zash.se>
date Sun, 28 May 2023 22:33:45 +0200
parent 13108:6cd768e6ac7c
child 13128:38582771b593
line wrap: on
line diff
--- a/plugins/mod_admin_shell.lua	Sat May 27 15:40:49 2023 +0200
+++ b/plugins/mod_admin_shell.lua	Sun May 28 22:33:45 2023 +0200
@@ -1836,9 +1836,13 @@
 function def_env.http:list(hosts)
 	local print = self.session.print;
 	hosts = array.collect(set.new({ not hosts and "*" or nil }) + get_hosts_set(hosts)):sort(_sort_hosts);
-	local output = format_table({
+	local output_simple = format_table({
 		{ title = "Module"; width = "1p" };
-		{ title = "URL"; width = "3p" };
+		{ title = "External URL"; width = "6p" };
+	}, self.session.width);
+	local output_split = format_table({
+		{ title = "Module"; width = "1p" };
+		{ title = "External URL"; width = "3p" };
 		{ title = "Internal URL"; width = "3p" };
 	}, self.session.width);
 
@@ -1851,14 +1855,14 @@
 			else
 				print("HTTP endpoints on "..host..(http_host and (" (using "..http_host.."):") or ":"));
 			end
-			print(output());
+			print(output_split());
 			for _, provider in ipairs(http_apps) do
 				local mod = provider._provided_by;
 				local external = module:context(host):http_url(provider.name, provider.default_path);
 				local internal = module:context(host):http_url(provider.name, provider.default_path, "internal");
 				if external==internal then internal="" end
 				mod = mod and "mod_"..mod or ""
-				print(output{mod, external, internal});
+				print((internal=="" and output_simple or output_split){mod, external, internal});
 			end
 			print("");
 		end