diff options
| author | Michael Klishin <mklishin@pivotal.io> | 2016-03-24 21:51:23 +0300 |
|---|---|---|
| committer | Michael Klishin <mklishin@pivotal.io> | 2016-03-24 21:51:23 +0300 |
| commit | ac9bafa4d53f72e57ccc45ad5088869093c89c13 (patch) | |
| tree | 19ed6731aaea7fcbd7ffa124bd47372c1b651213 /src | |
| parent | cc13f505d5062a29f5bd0819de71846c29f74875 (diff) | |
| parent | 6e5441fcc7fe152a8a4359b5be0ad81f268baa44 (diff) | |
| download | rabbitmq-server-git-ac9bafa4d53f72e57ccc45ad5088869093c89c13.tar.gz | |
Merge branch 'stable'
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_control_main.erl | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/rabbit_control_main.erl b/src/rabbit_control_main.erl index b7a7b51242..5fcf042893 100644 --- a/src/rabbit_control_main.erl +++ b/src/rabbit_control_main.erl @@ -750,15 +750,26 @@ default_if_empty(List, Default) when is_list(List) -> true -> [list_to_atom(X) || X <- List] end. +display_info_message_row(IsEscaped, Result, InfoItemKeys) -> + display_row([format_info_item( + case proplists:lookup(X, Result) of + none when is_list(Result), length(Result) > 0 -> + exit({error, {bad_info_key, X}}); + none -> Result; + {X, Value} -> Value + end, IsEscaped) || X <- InfoItemKeys]). + display_info_message(IsEscaped) -> - fun(Result, InfoItemKeys) -> - display_row([format_info_item( - case proplists:lookup(X, Result) of - none when is_list(Result), length(Result) > 0 -> - exit({error, {bad_info_key, X}}); - none -> Result; - {X, Value} -> Value - end, IsEscaped) || X <- InfoItemKeys]) + fun ([], _) -> + ok; + ([FirstResult|_] = List, InfoItemKeys) when is_list(FirstResult) -> + lists:foreach(fun(Result) -> + display_info_message_row(IsEscaped, Result, InfoItemKeys) + end, + List), + ok; + (Result, InfoItemKeys) -> + display_info_message_row(IsEscaped, Result, InfoItemKeys) end. display_info_list(Results, InfoItemKeys) when is_list(Results) -> |
