25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

ejabberd_ctl: Support policy=user in the help and return proper arguments

This commit is contained in:
Badlop 2023-09-21 13:41:44 +02:00
parent 8d39431d68
commit 245c9ae446

View File

@ -835,6 +835,11 @@ filter_commands_regexp(All, Glob) ->
end,
All).
maybe_add_policy_arguments(Args, user) ->
[{user, binary}, {host, binary} | Args];
maybe_add_policy_arguments(Args, _) ->
Args.
-spec print_usage_command(Cmd::string(), MaxC::integer(),
ShCode::boolean(), Version::integer()) -> ok.
print_usage_command(Cmd, MaxC, ShCode, Version) ->
@ -847,13 +852,15 @@ print_usage_command2(Cmd, C, MaxC, ShCode) ->
tags = TagsAtoms,
definer = Definer,
desc = Desc,
args = ArgsDef,
args = ArgsDefPreliminary,
policy = Policy,
longdesc = LongDesc,
result = ResultDef} = C,
NameFmt = [" ", ?B("Command Name"), ": ", ?C(Cmd), "\n"],
%% Initial indentation of result is 13 = length(" Arguments: ")
ArgsDef = maybe_add_policy_arguments(ArgsDefPreliminary, Policy),
Args = [format_usage_ctype(ArgDef, 13) || ArgDef <- ArgsDef],
ArgsMargin = lists:duplicate(13, $\s),
ArgsListFmt = case Args of