aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2025-02-13 16:16:19 +0000
committerMatthew Wild <mwild1@gmail.com>2025-02-13 16:16:19 +0000
commit009996c9e84a0a44d0f243e6eaa95956a91c0ed0 (patch)
treefe245692a9c5ce4de1471324859664b38ceec68e
parent4cc122bdc079b856df1f9456474856eb20d3e43e (diff)
downloadprosody-009996c9e84a0a44d0f243e6eaa95956a91c0ed0.tar.gz
prosody-009996c9e84a0a44d0f243e6eaa95956a91c0ed0.zip
mod_admin_shell: Support for hiding certain commands from default help listing
Useful for e.g. deprecated commands.
-rw-r--r--plugins/mod_admin_shell.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua
index 87d2ab4b..557487cc 100644
--- a/plugins/mod_admin_shell.lua
+++ b/plugins/mod_admin_shell.lua
@@ -349,7 +349,7 @@ module:hook("admin/repl-input", function (event)
return true;
end);
-local function describe_command(s)
+local function describe_command(s, hidden)
local section, name, args, desc = s:match("^([%w_]+):([%w_]+)%(([^)]*)%) %- (.+)$");
if not section then
error("Failed to parse command description: "..s);
@@ -360,6 +360,7 @@ local function describe_command(s)
args = array.collect(args:gmatch("[%w_]+")):map(function (arg_name)
return { name = arg_name };
end);
+ hidden = hidden;
};
end
@@ -455,10 +456,12 @@ def_env.help = setmetatable({}, {
end
for command, command_help in it.sorted_pairs(section_help.commands or {}) do
- c = c + 1;
- local args = array.pluck(command_help.args, "name"):concat(", ");
- local desc = command_help.desc or command_help.module and ("Provided by mod_"..command_help.module) or "";
- print(("%s:%s(%s) - %s"):format(section_name, command, args, desc));
+ if not command_help.hidden then
+ c = c + 1;
+ local args = array.pluck(command_help.args, "name"):concat(", ");
+ local desc = command_help.desc or command_help.module and ("Provided by mod_"..command_help.module) or "";
+ print(("%s:%s(%s) - %s"):format(section_name, command, args, desc));
+ end
end
elseif help_topics[section_name] then
local topic = help_topics[section_name];