|
 |
930bbf |
From: Peter Lemenkov <lemenkov@gmail.com>
|
|
 |
930bbf |
Date: Fri, 23 Oct 2015 16:05:41 +0300
|
|
 |
930bbf |
Subject: [PATCH] Recognize help as a valid sub-command
|
|
 |
930bbf |
|
|
 |
930bbf |
Some people believe that rabbitmqctl and rabbitmq-plugins should provide
|
|
 |
930bbf |
a valid help subcommand (instead of throwing an error). So here it is.
|
|
 |
930bbf |
|
|
 |
930bbf |
Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
|
|
 |
930bbf |
|
|
 |
930bbf |
diff --git a/src/rabbit_control_main.erl b/src/rabbit_control_main.erl
|
|
 |
930bbf |
index fe0563b..68d468f 100644
|
|
 |
930bbf |
--- a/src/rabbit_control_main.erl
|
|
 |
930bbf |
+++ b/src/rabbit_control_main.erl
|
|
 |
930bbf |
@@ -86,7 +86,8 @@
|
|
 |
930bbf |
close_connection,
|
|
 |
930bbf |
{trace_on, [?VHOST_DEF]},
|
|
 |
930bbf |
{trace_off, [?VHOST_DEF]},
|
|
 |
930bbf |
- set_vm_memory_high_watermark
|
|
 |
930bbf |
+ set_vm_memory_high_watermark,
|
|
 |
930bbf |
+ help
|
|
 |
930bbf |
]).
|
|
 |
930bbf |
|
|
 |
930bbf |
-define(GLOBAL_QUERIES,
|
|
 |
930bbf |
@@ -108,7 +109,7 @@
|
|
 |
930bbf |
[stop, stop_app, start_app, wait, reset, force_reset, rotate_logs,
|
|
 |
930bbf |
join_cluster, change_cluster_node_type, update_cluster_nodes,
|
|
 |
930bbf |
forget_cluster_node, rename_cluster_node, cluster_status, status,
|
|
 |
930bbf |
- environment, eval, force_boot]).
|
|
 |
930bbf |
+ environment, eval, force_boot, help]).
|
|
 |
930bbf |
|
|
 |
930bbf |
-define(COMMANDS_WITH_TIMEOUT,
|
|
 |
930bbf |
[list_user_permissions, list_policies, list_queues, list_exchanges,
|
|
 |
930bbf |
@@ -483,6 +484,9 @@ action(eval, Node, [Expr], _Opts, _Inform) ->
|
|
 |
930bbf |
{error_string, format_parse_error(E)}
|
|
 |
930bbf |
end;
|
|
 |
930bbf |
|
|
 |
930bbf |
+action(help, _Node, _Args, _Opts, _Inform) ->
|
|
 |
930bbf |
+ io:format("~s", [rabbit_ctl_usage:usage()]);
|
|
 |
930bbf |
+
|
|
 |
930bbf |
action(Command, Node, Args, Opts, Inform) ->
|
|
 |
930bbf |
%% For backward compatibility, run commands accepting a timeout with
|
|
 |
930bbf |
%% the default timeout.
|
|
 |
930bbf |
diff --git a/src/rabbit_plugins_main.erl b/src/rabbit_plugins_main.erl
|
|
 |
930bbf |
index a4d5490..4aeed48 100644
|
|
 |
930bbf |
--- a/src/rabbit_plugins_main.erl
|
|
 |
930bbf |
+++ b/src/rabbit_plugins_main.erl
|
|
 |
930bbf |
@@ -27,7 +27,8 @@
|
|
 |
930bbf |
{enable, [?OFFLINE_DEF, ?ONLINE_DEF]},
|
|
 |
930bbf |
{disable, [?OFFLINE_DEF, ?ONLINE_DEF]},
|
|
 |
930bbf |
{set, [?OFFLINE_DEF, ?ONLINE_DEF]},
|
|
 |
930bbf |
- {sync, []}]).
|
|
 |
930bbf |
+ {sync, []},
|
|
 |
930bbf |
+ {help, []}]).
|
|
 |
930bbf |
|
|
 |
930bbf |
%%----------------------------------------------------------------------------
|
|
 |
930bbf |
|
|
 |
930bbf |
@@ -147,7 +148,10 @@ action(disable, Node, ToDisable0, Opts, State = #cli{all = All,
|
|
 |
930bbf |
action_change(Opts, Node, Implicit, NewImplicit, State);
|
|
 |
930bbf |
|
|
 |
930bbf |
action(sync, Node, [], _Opts, State) ->
|
|
 |
930bbf |
- sync(Node, true, State).
|
|
 |
930bbf |
+ sync(Node, true, State);
|
|
 |
930bbf |
+
|
|
 |
930bbf |
+action(help, _Node, _Args, _Opts, _State) ->
|
|
 |
930bbf |
+ io:format("~s", [rabbit_plugins_usage:usage()]).
|
|
 |
930bbf |
|
|
 |
930bbf |
%%----------------------------------------------------------------------------
|
|
 |
930bbf |
|