# HG changeset patch # User Matthew Wild # Date 1739463379 0 # Node ID 4c1f26b4883b76c3e07ddcacc1a01365d4b5262f # Parent 0055c177a54c46a36d597954d610db04157b5852 mod_admin_shell: Support for hiding certain commands from default help listing Useful for e.g. deprecated commands. diff -r 0055c177a54c -r 4c1f26b4883b plugins/mod_admin_shell.lua --- a/plugins/mod_admin_shell.lua Thu Feb 13 16:15:16 2025 +0000 +++ b/plugins/mod_admin_shell.lua Thu Feb 13 16:16:19 2025 +0000 @@ -349,7 +349,7 @@ 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 @@ args = array.collect(args:gmatch("[%w_]+")):map(function (arg_name) return { name = arg_name }; end); + hidden = hidden; }; end @@ -455,10 +456,12 @@ 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];