25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

ejabberd_ctl: When API version>0, update syntax of list results

This commit is contained in:
Badlop 2023-11-30 17:09:25 +01:00
parent d65638efe1
commit 90766685ae

View File

@ -445,12 +445,16 @@ format_result([FirstElement | Elements], {_Name, {top_result_list, ElementsDef}}
format_result([], {_Name, {list, _ElementsDef}}, _Version) ->
"";
format_result([FirstElement | Elements], {_Name, {list, ElementsDef}}, Version) ->
Separator = case Version of
0 -> ";";
_ -> ","
end,
%% Start formatting the first element
[format_result(FirstElement, ElementsDef, Version) |
%% If there are more elements, put always first a newline character
lists:map(
fun(Element) ->
[";" | format_result(Element, ElementsDef, Version)]
[Separator | format_result(Element, ElementsDef, Version)]
end,
Elements)];
@ -782,8 +786,9 @@ print_usage_help(MaxC, ShCode) ->
"Separate the elements in a list with the , character.\n",
"Separate the elements in a tuple with the : character.\n",
"\n",
"Some commands return lists, like get_roster and get_user_subscriptions.\n",
"In those commands, the elements in the list are separated with: ;\n"],
"Some commands results are lists or tuples, like get_roster and get_user_subscriptions.\n",
"The elements in a list are separated with a , character.\n",
"The elements in a tuple are separated with a tabular character.\n"],
ArgsDef = [],
C = #ejabberd_commands{
name = help,