mirror of
https://github.com/processone/ejabberd
synced 2025-10-03 09:49:18 +02:00
ejabberd_web_admin: Support commands with tuple arguments; fix list indent
This commit is contained in:
parent
29616dc163
commit
62a165e4cf
1 changed files with 15 additions and 5 deletions
|
@ -2359,11 +2359,21 @@ format_result([], {_Name, {list, _ElementsDef}}) ->
|
||||||
"";
|
"";
|
||||||
format_result([FirstElement | Elements], {_Name, {list, ElementsDef}}) ->
|
format_result([FirstElement | Elements], {_Name, {list, ElementsDef}}) ->
|
||||||
Separator = ",",
|
Separator = ",",
|
||||||
[format_result(FirstElement, ElementsDef) | lists:map(fun(Element) ->
|
Head = format_result(FirstElement, ElementsDef),
|
||||||
[Separator | format_result(Element,
|
Tail =
|
||||||
ElementsDef)]
|
lists:map(fun(Element) -> [Separator | format_result(Element, ElementsDef)] end,
|
||||||
end,
|
Elements),
|
||||||
Elements)];
|
[Head | Tail];
|
||||||
|
format_result([], {_Name, {tuple, _ElementsDef}}) ->
|
||||||
|
"";
|
||||||
|
format_result(Value, {_Name, {tuple, [FirstDef | ElementsDef]}}) ->
|
||||||
|
[FirstElement | Elements] = tuple_to_list(Value),
|
||||||
|
Separator = ":",
|
||||||
|
Head = format_result(FirstElement, FirstDef),
|
||||||
|
Tail =
|
||||||
|
lists:map(fun(Element) -> [Separator | format_result(Element, ElementsDef)] end,
|
||||||
|
Elements),
|
||||||
|
[Head | Tail];
|
||||||
format_result(Value, _ResultFormat) when is_atom(Value) ->
|
format_result(Value, _ResultFormat) when is_atom(Value) ->
|
||||||
misc:atom_to_binary(Value);
|
misc:atom_to_binary(Value);
|
||||||
format_result(Value, _ResultFormat) when is_list(Value) ->
|
format_result(Value, _ResultFormat) when is_list(Value) ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue