summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2012-10-29 14:22:58 +0000
committerSimon MacMullen <simon@rabbitmq.com>2012-10-29 14:22:58 +0000
commit8d72e0af5163596451aaa6fa5da1d4cfd71c1ef5 (patch)
tree593e98fa7872a24e59c04e19c82057e801e6188c
parentc6b860224dbed68853e7cb0ef4879e4c42f85bb5 (diff)
downloadrabbitmq-server-8d72e0af5163596451aaa6fa5da1d4cfd71c1ef5.tar.gz
Shorter.
-rw-r--r--src/rabbit_plugins_main.erl29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/rabbit_plugins_main.erl b/src/rabbit_plugins_main.erl
index 33092f39..33da1821 100644
--- a/src/rabbit_plugins_main.erl
+++ b/src/rabbit_plugins_main.erl
@@ -218,28 +218,19 @@ format_plugin(#plugin{name = Name, version = Version,
{_, _, true} -> "[!]";
_ -> "[ ]"
end,
+ Opt = fun (_F, A, A) -> ok;
+ ( F, A, _) -> io:format(F, [A])
+ end,
case Format of
minimal -> io:format("~s~n", [Name]);
- normal -> io:format("~s ~-" ++ integer_to_list(MaxWidth) ++ "w ~s~n",
- [Glyph, Name, case Version of
- undefined -> "";
- _ -> Version
- end]);
+ normal -> io:format("~s ~-" ++ integer_to_list(MaxWidth) ++ "w",
+ [Glyph, Name]),
+ Opt("~s", Version, undefined),
+ io:format("~n");
verbose -> io:format("~s ~w~n", [Glyph, Name]),
- case Version of
- undefined -> ok;
- _ -> io:format(" Version: \t~s~n",
- [Version])
- end,
- case Deps of
- [] -> ok;
- _ -> io:format(" Dependencies:\t~p~n", [Deps])
- end,
- case Description of
- undefined -> ok;
- _ -> io:format(" Description:\t~s~n",
- [Description])
- end,
+ Opt(" Version: \t~s~n", Version, undefined),
+ Opt(" Dependencies:\t~p~n", Deps, []),
+ Opt(" Description:\t~s~n", Description, undefined),
io:format("~n")
end.