summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2011-09-22 18:27:42 +0100
committerAlexandru Scvortov <alexandru@rabbitmq.com>2011-09-22 18:27:42 +0100
commita05e7717539d39bedff3e17b03c87845881fc600 (patch)
tree0e862031578c5451bd7367314146131eb7cac987
parentc4caae36bdb0179211d1aa6c665bc5466c74f563 (diff)
downloadrabbitmq-server-git-a05e7717539d39bedff3e17b03c87845881fc600.tar.gz
compact -> verbose
-rw-r--r--docs/rabbitmq-plugins.1.xml19
-rw-r--r--src/rabbit_plugins.erl20
2 files changed, 19 insertions, 20 deletions
diff --git a/docs/rabbitmq-plugins.1.xml b/docs/rabbitmq-plugins.1.xml
index edc1ef9365..a04dccde57 100644
--- a/docs/rabbitmq-plugins.1.xml
+++ b/docs/rabbitmq-plugins.1.xml
@@ -60,12 +60,12 @@
<variablelist>
<varlistentry>
- <term><cmdsynopsis><command>list</command> <arg choice="opt">-c</arg> <arg choice="opt"><replaceable>pattern</replaceable></arg></cmdsynopsis></term>
+ <term><cmdsynopsis><command>list</command> <arg choice="opt">-v</arg> <arg choice="opt"><replaceable>pattern</replaceable></arg></cmdsynopsis></term>
<listitem>
<variablelist>
<varlistentry>
- <term>-c</term>
- <listitem><para>List plugins compactly.</para></listitem>
+ <term>-v</term>
+ <listitem><para>Show all plugin details.</para></listitem>
</varlistentry>
<varlistentry>
<term>pattern</term>
@@ -83,17 +83,16 @@
<para role="example-prefix">For example:</para>
<screen role="example">rabbitmq-plugins list</screen>
<para role="example">
- This command lists all the plugins available.
+ This command lists all the plugins available, on one line each.
</para>
- <screen role="example">rabbitmq-plugins list -c</screen>
+ <screen role="example">rabbitmq-plugins list -v </screen>
<para role="example">
- This command lists all the plugins available, on one line each.
+ This command lists all the plugins available.
</para>
- <screen role="example">rabbitmq-plugins list -c management</screen>
+ <screen role="example">rabbitmq-plugins list -v management</screen>
<para role="example">
- This command lists all the plugins available, on one
- line each, but does not display plugins whose name does
- not contain "management".
+ This command lists all the plugins available, but does not
+ display plugins whose name does not contain "management".
</para>
</listitem>
</varlistentry>
diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl
index b5bcf8200d..fc59846e0f 100644
--- a/src/rabbit_plugins.erl
+++ b/src/rabbit_plugins.erl
@@ -20,7 +20,7 @@
-export([start/0, stop/0, find_plugins/1, read_enabled_plugins/1,
lookup_plugins/2, calculate_required_plugins/2]).
--define(COMPACT_OPT, "-c").
+-define(VERBOSE_OPT, "-v").
%%----------------------------------------------------------------------------
@@ -39,7 +39,7 @@ start() ->
{ok, [[PluginsDistDir|_]|_]} = init:get_argument(plugins_dist_dir),
put(plugins_dist_dir, PluginsDistDir),
{[Command0 | Args], Opts} =
- case rabbit_misc:get_options([{flag, ?COMPACT_OPT}],
+ case rabbit_misc:get_options([{flag, ?VERBOSE_OPT}],
init:get_plain_arguments()) of
{[], _Opts} -> usage();
CmdArgsAndOpts -> CmdArgsAndOpts
@@ -76,7 +76,7 @@ usage() ->
action(list, [], Opts) ->
action(list, [".*"], Opts);
action(list, [Pat], Opts) ->
- format_plugins(Pat, proplists:get_bool(?COMPACT_OPT, Opts));
+ format_plugins(Pat, proplists:get_bool(?VERBOSE_OPT, Opts));
action(enable, ToEnable0, _Opts) ->
AllPlugins = find_plugins(),
@@ -201,7 +201,7 @@ parse_binary(Bin) ->
end.
%% Pretty print a list of plugins.
-format_plugins(Pattern, Compact) ->
+format_plugins(Pattern, Verbose) ->
AvailablePlugins = find_plugins(),
EnabledExplicitly = read_enabled_plugins(),
EnabledImplicitly =
@@ -212,25 +212,25 @@ format_plugins(Pattern, Compact) ->
Plugin = #plugin{name = Name} <- AvailablePlugins,
re:run(atom_to_list(Name), RE, [{capture, none}]) =:= match],
MaxWidth = lists:max([length(atom_to_list(Name)) ||
- #plugin{name = Name} <- Plugins]),
- [ format_plugin(P, EnabledExplicitly, EnabledImplicitly, Compact, MaxWidth) ||
+ #plugin{name = Name} <- Plugins] ++ [0]),
+ [ format_plugin(P, EnabledExplicitly, EnabledImplicitly, Verbose, MaxWidth) ||
P <- Plugins],
ok.
format_plugin(#plugin{name = Name, version = Version, description = Description,
dependencies = Dependencies},
- EnabledExplicitly, EnabledImplicitly, Compact, MaxWidth) ->
+ EnabledExplicitly, EnabledImplicitly, Verbose, MaxWidth) ->
Glyph = case {lists:member(Name, EnabledExplicitly),
lists:member(Name, EnabledImplicitly)} of
{true, false} -> "[E]";
{false, true} -> "[e]";
_ -> "[ ]"
end,
- case Compact of
- true ->
+ case Verbose of
+ false ->
io:format("~s ~-" ++ integer_to_list(MaxWidth) ++
"w ~s~n", [Glyph, Name, Version]);
- false ->
+ true ->
io:format("~s ~w~n", [Glyph, Name]),
io:format(" Version: \t~s~n", [Version]),
case Dependencies of