From d6789e60f2aebc9f2e6b69e642c384ee85751fbd Mon Sep 17 00:00:00 2001 From: Daniil Fedotov Date: Fri, 8 Feb 2019 15:33:17 -0500 Subject: A new way to display basic usage. Do not show additional parameters info. List commands as names and descriptions. Group commands in sections. New behaviour callbacks: help_section/0 - atom name of a group to put command to. Default is :other description/0 - single line description of the command. Printed in the commands list Sections ans descriptions are WIP. --- .../lib/rabbitmq/cli/command_behaviour.ex | 5 + .../rabbitmq/cli/ctl/commands/add_user_command.ex | 1 + .../rabbitmq/cli/ctl/commands/add_vhost_command.ex | 1 + .../cli/ctl/commands/authenticate_user_command.ex | 1 + .../cli/ctl/commands/await_online_nodes_command.ex | 4 + .../cli/ctl/commands/await_startup_command.ex | 4 + .../cli/ctl/commands/cancel_sync_queue_command.ex | 2 + .../commands/change_cluster_node_type_command.ex | 4 + .../cli/ctl/commands/change_password_command.ex | 2 + .../ctl/commands/clear_global_parameter_command.ex | 2 + .../ctl/commands/clear_operator_policy_command.ex | 2 + .../cli/ctl/commands/clear_parameter_command.ex | 2 + .../cli/ctl/commands/clear_password_command.ex | 1 + .../cli/ctl/commands/clear_permissions_command.ex | 1 + .../cli/ctl/commands/clear_policy_command.ex | 2 + .../commands/clear_topic_permissions_command.ex | 1 + .../cli/ctl/commands/clear_vhost_limits_command.ex | 2 + .../cli/ctl/commands/cluster_status_command.ex | 4 + .../rabbitmq/cli/ctl/commands/decode_command.ex | 4 + .../cli/ctl/commands/delete_queue_command.ex | 2 + .../cli/ctl/commands/delete_user_command.ex | 1 + .../cli/ctl/commands/delete_vhost_command.ex | 1 + .../ctl/commands/enable_feature_flag_command.ex | 2 + .../rabbitmq/cli/ctl/commands/encode_command.ex | 4 + .../cli/ctl/commands/environment_command.ex | 2 + .../cli/ctl/commands/force_boot_command.ex | 4 + .../cli/ctl/commands/force_reset_command.ex | 4 + .../ctl/commands/forget_cluster_node_command.ex | 4 + .../lib/rabbitmq/cli/ctl/commands/help_command.ex | 167 ++++++++++++++++----- .../cli/ctl/commands/hipe_compile_command.ex | 2 + .../cli/ctl/commands/join_cluster_command.ex | 4 + .../cli/ctl/commands/list_bindings_command.ex | 2 + .../cli/ctl/commands/list_channels_command.ex | 2 + .../cli/ctl/commands/list_ciphers_command.ex | 4 + .../cli/ctl/commands/list_connections_command.ex | 2 + .../cli/ctl/commands/list_consumers_command.ex | 2 + .../cli/ctl/commands/list_exchanges_command.ex | 2 + .../cli/ctl/commands/list_feature_flags_command.ex | 2 + .../ctl/commands/list_global_parameters_command.ex | 2 + .../cli/ctl/commands/list_hashes_command.ex | 4 + .../ctl/commands/list_operator_policies_command.ex | 1 + .../cli/ctl/commands/list_parameters_command.ex | 1 + .../cli/ctl/commands/list_permissions_command.ex | 1 + .../cli/ctl/commands/list_policies_command.ex | 1 + .../cli/ctl/commands/list_queues_command.ex | 2 + .../ctl/commands/list_topic_permissions_command.ex | 1 + .../commands/list_unresponsive_queues_command.ex | 2 + .../ctl/commands/list_user_permissions_command.ex | 1 + .../list_user_topic_permissions_command.ex | 1 + .../cli/ctl/commands/list_users_command.ex | 1 + .../cli/ctl/commands/list_vhost_limits_command.ex | 2 + .../cli/ctl/commands/list_vhosts_command.ex | 1 + .../lib/rabbitmq/cli/ctl/commands/ping_command.ex | 4 + .../cli/ctl/commands/purge_queue_command.ex | 2 + .../cli/ctl/commands/quorum_status_command.ex | 2 + .../ctl/commands/rename_cluster_node_command.ex | 4 + .../rabbitmq/cli/ctl/commands/report_command.ex | 2 + .../lib/rabbitmq/cli/ctl/commands/reset_command.ex | 4 + .../cli/ctl/commands/restart_vhost_command.ex | 1 + .../cli/ctl/commands/rotate_logs_command.ex | 4 + .../cli/ctl/commands/set_cluster_name_command.ex | 2 + .../ctl/commands/set_disk_free_limit_command.ex | 2 + .../ctl/commands/set_global_parameter_command.ex | 2 + .../cli/ctl/commands/set_log_level_command.ex | 2 + .../ctl/commands/set_operator_policy_command.ex | 2 + .../cli/ctl/commands/set_parameter_command.ex | 2 + .../cli/ctl/commands/set_permissions_command.ex | 1 + .../cli/ctl/commands/set_policy_command.ex | 2 + .../ctl/commands/set_topic_permissions_command.ex | 2 + .../cli/ctl/commands/set_user_tags_command.ex | 2 + .../cli/ctl/commands/set_vhost_limits_command.ex | 2 + .../set_vm_memory_high_watermark_command.ex | 2 + .../rabbitmq/cli/ctl/commands/shutdown_command.ex | 4 + .../rabbitmq/cli/ctl/commands/start_app_command.ex | 4 + .../rabbitmq/cli/ctl/commands/status_command.ex | 2 + .../rabbitmq/cli/ctl/commands/stop_app_command.ex | 4 + .../lib/rabbitmq/cli/ctl/commands/stop_command.ex | 4 + .../cli/ctl/commands/sync_queue_command.ex | 2 + .../rabbitmq/cli/ctl/commands/trace_off_command.ex | 2 + .../rabbitmq/cli/ctl/commands/trace_on_command.ex | 2 + .../ctl/commands/update_cluster_nodes_command.ex | 4 + .../lib/rabbitmq/cli/ctl/commands/wait_command.ex | 4 + deps/rabbitmq_cli/lib/rabbitmqctl.ex | 1 + 83 files changed, 322 insertions(+), 36 deletions(-) (limited to 'deps/rabbitmq_cli') diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/command_behaviour.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/command_behaviour.ex index fef77a2046..6876df56b8 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/command_behaviour.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/command_behaviour.ex @@ -28,9 +28,12 @@ defmodule RabbitMQ.CLI.CommandBehaviour do | {:ok, any} | {:stream, Enum.t()} | {:error, RabbitMQ.CLI.Core.ExitCodes.exit_code(), [String.t()]} + @optional_callbacks formatter: 0, scopes: 0, usage_additional: 0, + description: 0, + help_section: 0, switches: 0, aliases: 0, # validates execution environment, e.g. file presence, @@ -45,6 +48,8 @@ defmodule RabbitMQ.CLI.CommandBehaviour do @callback formatter() :: atom() @callback scopes() :: [atom()] + @callback description() :: String.t() + @callback help_section() :: String.t() @callback usage_additional() :: String.t() | [String.t()] ## Erlang distribution control ## :cli - default rabbitmqctl generated node name diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/add_user_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/add_user_command.ex index 268302a7d0..99348838fc 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/add_user_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/add_user_command.ex @@ -46,6 +46,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.AddUserCommand do end def usage, do: "add_user " + def help_section(), do: :user_management def banner([username, _password], _), do: "Adding user \"#{username}\" ..." diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/add_vhost_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/add_vhost_command.ex index 207b3d65e4..007f31346b 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/add_vhost_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/add_vhost_command.ex @@ -29,6 +29,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.AddVhostCommand do use RabbitMQ.CLI.DefaultOutput def usage, do: "add_vhost " + def help_section(), do: :vhost def banner([vhost], _), do: "Adding vhost \"#{vhost}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/authenticate_user_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/authenticate_user_command.ex index 19ccaaea27..28eb487291 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/authenticate_user_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/authenticate_user_command.ex @@ -34,6 +34,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.AuthenticateUserCommand do end def usage, do: "authenticate_user " + def help_section(), do: :user_management def banner([username, _password], _), do: "Authenticating user \"#{username}\" ..." diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/await_online_nodes_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/await_online_nodes_command.ex index add54db2d7..d28621cb32 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/await_online_nodes_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/await_online_nodes_command.ex @@ -42,6 +42,10 @@ defmodule RabbitMQ.CLI.Ctl.Commands.AwaitOnlineNodesCommand do "await_online_nodes " end + def help_section(), do: :cluster_management + + def description(), do: "Wait for nodes to join the cluster" + def banner([count], %{node: node_name, timeout: timeout}) when is_number(timeout) do "Will wait for at least #{count} nodes to join the cluster of #{node_name}. Timeout: #{ trunc(timeout / 1000) diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/await_startup_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/await_startup_command.ex index be10bc0ee6..1665596559 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/await_startup_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/await_startup_command.ex @@ -46,5 +46,9 @@ defmodule RabbitMQ.CLI.Ctl.Commands.AwaitStartupCommand do def usage, do: "await_startup" + def help_section(), do: :node_management + + def description(), do: "Waits for the RabbitMQ application to start on existing node" + def banner(_, _), do: nil end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/cancel_sync_queue_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/cancel_sync_queue_command.ex index deb391e864..0e34a2dc8e 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/cancel_sync_queue_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/cancel_sync_queue_command.ex @@ -37,6 +37,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.CancelSyncQueueCommand do def usage, do: "cancel_sync_queue [-p ] queue" + def help_section(), do: :queues + def banner([queue], %{vhost: vhost, node: _node}) do "Stopping synchronising queue '#{queue}' in vhost '#{vhost}' ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/change_cluster_node_type_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/change_cluster_node_type_command.ex index da453f20f7..cdd6756ea3 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/change_cluster_node_type_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/change_cluster_node_type_command.ex @@ -53,6 +53,10 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ChangeClusterNodeTypeCommand do "change_cluster_node_type " end + def help_section(), do: :cluster_management + + def description(), do: "Change cluster node type depm disc to ram anv vice-versa" + def banner([node_type], %{node: node_name}) do "Turning #{node_name} into a #{node_type} node" end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/change_password_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/change_password_command.ex index a21e57a2c7..59c8e0b62c 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/change_password_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/change_password_command.ex @@ -37,5 +37,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ChangePasswordCommand do def usage, do: "change_password " + def help_section(), do: :user_management + def banner([user | _], _), do: "Changing password for user \"#{user}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_global_parameter_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_global_parameter_command.ex index 1576d0d0c4..25d1578c9f 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_global_parameter_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_global_parameter_command.ex @@ -35,6 +35,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearGlobalParameterCommand do def usage, do: "clear_global_parameter " + def help_section(), do: :parameters + def banner([key], _) do "Clearing global runtime parameter \"#{key}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_operator_policy_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_operator_policy_command.ex index f163d16541..acf0d35aad 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_operator_policy_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_operator_policy_command.ex @@ -36,6 +36,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearOperatorPolicyCommand do def usage, do: "clear_operator_policy [-p ] " + def help_section(), do: :parameters + def banner([key], %{vhost: vhost}) do "Clearing operator policy \"#{key}\" on vhost \"#{vhost}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_parameter_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_parameter_command.ex index cad7a306f1..ce471851dc 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_parameter_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_parameter_command.ex @@ -46,6 +46,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearParameterCommand do def usage, do: "clear_parameter [-p ] " + def help_section(), do: :parameters + def banner([component_name, key], %{vhost: vhost}) do "Clearing runtime parameter \"#{key}\" for component \"#{component_name}\" on vhost \"#{vhost}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_password_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_password_command.ex index 3950a72ea1..bc3e35ba97 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_password_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_password_command.ex @@ -34,6 +34,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearPasswordCommand do use RabbitMQ.CLI.DefaultOutput def usage, do: "clear_password " + def help_section(), do: :user_management def banner([user], _), do: "Clearing password for user \"#{user}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_permissions_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_permissions_command.ex index 414a934304..111e3e633c 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_permissions_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_permissions_command.ex @@ -36,6 +36,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearPermissionsCommand do use RabbitMQ.CLI.DefaultOutput def usage, do: "clear_permissions [-p vhost] " + def help_section(), do: :user_management def banner([username], %{vhost: vhost}) do "Clearing permissions for user \"#{username}\" in vhost \"#{vhost}\" ..." diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_policy_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_policy_command.ex index 8dae479717..8a5eb198f7 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_policy_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_policy_command.ex @@ -36,6 +36,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearPolicyCommand do def usage, do: "clear_policy [-p ] " + def help_section(), do: :parameters + def banner([key], %{vhost: vhost}) do "Clearing policy \"#{key}\" on vhost \"#{vhost}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_topic_permissions_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_topic_permissions_command.ex index 858d386cde..c53faae83b 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_topic_permissions_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_topic_permissions_command.ex @@ -54,6 +54,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearTopicPermissionsCommand do end def usage, do: "clear_topic_permissions [-p vhost] []" + def help_section(), do: :user_management def banner([username], %{vhost: vhost}) do "Clearing topic permissions for user \"#{username}\" in vhost \"#{vhost}\" ..." diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_vhost_limits_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_vhost_limits_command.ex index 16ed6084e2..f3be7eaf28 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_vhost_limits_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/clear_vhost_limits_command.ex @@ -36,6 +36,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearVhostLimitsCommand do def usage, do: "clear_vhost_limits [-p ]" + def help_section(), do: :parameters + def banner([], %{vhost: vhost}) do "Clearing vhost \"#{vhost}\" limits ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/cluster_status_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/cluster_status_command.ex index 2a077591e0..dc69590c3c 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/cluster_status_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/cluster_status_command.ex @@ -48,6 +48,10 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClusterStatusCommand do def usage, do: "cluster_status" + def help_section(), do: :cluster_management + + def description(), do: "Print cluster status of the node" + def banner(_, %{node: node_name}), do: "Cluster status of node #{node_name} ..." # diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/decode_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/decode_command.ex index 9c529202ef..417a932418 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/decode_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/decode_command.ex @@ -91,6 +91,10 @@ defmodule RabbitMQ.CLI.Ctl.Commands.DecodeCommand do def usage, do: "decode value passphrase [--cipher cipher] [--hash hash] [--iterations iterations]" + def help_section(), do: :encode + + def description(), do: "Decrypt a value" + def banner([_, _], _) do "Decrypting value ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/delete_queue_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/delete_queue_command.ex index 003a257458..403b6632d2 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/delete_queue_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/delete_queue_command.ex @@ -21,6 +21,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.DeleteQueueCommand do def usage(), do: "delete_queue queue_name [--if_empty|-e] [--if_unused|-u]" + def help_section(), do: :queues + def banner([qname], %{vhost: vhost, if_empty: if_empty, if_unused: if_unused}) do if_empty_str = case if_empty do diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/delete_user_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/delete_user_command.ex index 0037855e9e..b8285e6d6f 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/delete_user_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/delete_user_command.ex @@ -34,6 +34,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.DeleteUserCommand do use RabbitMQ.CLI.DefaultOutput def usage, do: "delete_user " + def help_section(), do: :user_management def banner([arg], _), do: "Deleting user \"#{arg}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/delete_vhost_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/delete_vhost_command.ex index 5186165ef4..87c8ead10d 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/delete_vhost_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/delete_vhost_command.ex @@ -29,6 +29,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.DeleteVhostCommand do use RabbitMQ.CLI.DefaultOutput def usage, do: "delete_vhost " + def help_section(), do: :vhost def banner([arg], _), do: "Deleting vhost \"#{arg}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/enable_feature_flag_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/enable_feature_flag_command.ex index 24bdea423c..3ac2f0dd3b 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/enable_feature_flag_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/enable_feature_flag_command.ex @@ -33,5 +33,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.EnableFeatureFlagCommand do def usage, do: "enable_feature_flag " + def help_section(), do: :feature_flags + def banner([feature_flag], _), do: "Enabling feature flag \"#{feature_flag}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/encode_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/encode_command.ex index 5d472da183..16c3e248a5 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/encode_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/encode_command.ex @@ -81,6 +81,10 @@ defmodule RabbitMQ.CLI.Ctl.Commands.EncodeCommand do def usage, do: "encode value passphrase [--cipher cipher] [--hash hash] [--iterations iterations]" + def help_section(), do: :encode + + def description(), do: "Encrypt a value" + def banner([_, _], _) do "Encrypting value ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/environment_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/environment_command.ex index 651c9c43d8..91d9a158c0 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/environment_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/environment_command.ex @@ -31,5 +31,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.EnvironmentCommand do def usage, do: "environment" + def help_section(), do: :report + def banner(_, %{node: node_name}), do: "Application environment of node #{node_name} ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/force_boot_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/force_boot_command.ex index 37ec51ada2..7265039e38 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/force_boot_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/force_boot_command.ex @@ -52,5 +52,9 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ForceBootCommand do def usage, do: "force_boot" + def help_section(), do: :cluster_management + + def description(), do: "Ensures that the node will start next time, even if it was not the last to shut down" + def banner(_, _), do: nil end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/force_reset_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/force_reset_command.ex index c0cf9a5a7e..0f4734a90e 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/force_reset_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/force_reset_command.ex @@ -35,5 +35,9 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ForceResetCommand do def usage, do: "force_reset" + def help_section(), do: :cluster_management + + def description(), do: "Forcefully returns a RabbitMQ node to its virgin state" + def banner(_, %{node: node_name}), do: "Forcefully resetting node #{node_name} ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/forget_cluster_node_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/forget_cluster_node_command.ex index dea71682ed..a204020016 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/forget_cluster_node_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/forget_cluster_node_command.ex @@ -66,6 +66,10 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ForgetClusterNodeCommand do "forget_cluster_node [--offline] " end + def help_section(), do: :cluster_management + + def description(), do: "Remove a stopped node from the cluster" + def banner([node_to_remove], _) do "Removing node #{node_to_remove} from the cluster" end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/help_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/help_command.ex index 06c8b0d0b1..44337f2281 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/help_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/help_command.ex @@ -15,6 +15,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.HelpCommand do alias RabbitMQ.CLI.Core.{CommandModules, Config, ExitCodes} + alias RabbitMQ.CLI.Core.CommandModules + @behaviour RabbitMQ.CLI.CommandBehaviour @@ -44,7 +46,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.HelpCommand do CommandModules.load(opts) case opts[:list_commands] do - true -> commands() + true -> commands_description() _ -> all_usage(opts) end end @@ -58,11 +60,12 @@ defmodule RabbitMQ.CLI.Ctl.Commands.HelpCommand do end def all_usage(opts) do + tool_name = program_name(opts) Enum.join( - tool_usage(program_name(opts)) ++ + tool_usage(tool_name) ++ options_usage() ++ - [Enum.join(["Commands:"] ++ commands(), "\n")] ++ - additional_usage(), + [Enum.join(["Commands:"] ++ commands_description(), "\n")] ++ + help_additional(tool_name), "\n\n" ) end @@ -76,10 +79,12 @@ defmodule RabbitMQ.CLI.Ctl.Commands.HelpCommand do def usage(), do: "help ( | [--list-commands])" + def help_section(), do: :help + defp tool_usage(tool_name) do [ "\nUsage:\n" <> - "#{tool_name} [-n ] [-t ] [-l] [-q] []" + "#{tool_name} [-n ] [-t ] [-l|--longnames] [-q|--quiet] []" ] end @@ -110,35 +115,121 @@ defmodule RabbitMQ.CLI.Ctl.Commands.HelpCommand do end defp options_usage() do - ["General options: - short | long | description - -----------------|---------------|-------------------------------- - -? | --help | displays command usage information - -n | --node | connect to node - -l | --longnames | use long host names - -q | --quiet | suppress informational messages - -s | --silent | suppress informational messages - | and table header row - -Default node is \"rabbit@server\", where `server` is the local hostname. On a host -named \"server.example.com\", the node name of the RabbitMQ Erlang node will -usually be rabbit@server (unless RABBITMQ_NODENAME has been set to some -non-default value at broker startup time). The output of hostname -s is usually -the correct suffix to use after the \"@\" sign. See rabbitmq-server(1) for -details of configuring the RabbitMQ broker. + [ + # "General options: + # short | long | description + # -----------------|---------------|-------------------------------- + # -? | --help | displays command usage information + # -n | --node | connect to node + # -l | --longnames | use long host names + # -q | --quiet | suppress informational messages + # -s | --silent | suppress informational messages + # | and table header row" +# , +# " +# Default node is \"rabbit@server\", where `server` is the local hostname. On a host +# named \"server.example.com\", the node name of the RabbitMQ Erlang node will +# usually be rabbit@server (unless RABBITMQ_NODENAME has been set to some +# non-default value at broker startup time). The output of hostname -s is usually +# the correct suffix to use after the \"@\" sign. See rabbitmq-server(1) for +# details of configuring the RabbitMQ broker. + +# Most options have a corresponding \"long option\" i.e. \"-q\" or \"--quiet\". +# Long options for boolean values may be negated with the \"--no-\" prefix, +# i.e. \"--no-quiet\" or \"--no-table-headers\" + +# Quiet output mode is selected with the \"-q\" flag. Informational messages are +# suppressed when quiet mode is in effect. + +# If target RabbitMQ node is configured to use long node names, the \"--longnames\" +# option must be specified. + +# Some commands accept an optional virtual host parameter for which +# to display results. The default value is \"/\"." +] + end -Most options have a corresponding \"long option\" i.e. \"-q\" or \"--quiet\". -Long options for boolean values may be negated with the \"--no-\" prefix, -i.e. \"--no-quiet\" or \"--no-table-headers\" + def commands_description() do + module_map = CommandModules.module_map() -Quiet output mode is selected with the \"-q\" flag. Informational messages are -suppressed when quiet mode is in effect. + pad_commands_to = Enum.reduce(module_map, 0, + fn({name, _}, longest) -> + name_length = String.length(name) + case name_length > longest do + true -> name_length + false -> longest + end + end) -If target RabbitMQ node is configured to use long node names, the \"--longnames\" -option must be specified. + module_map + |> Enum.map( + fn({name, cmd}) -> + description = case function_exported?(cmd, :description, 0) do + true -> cmd.description() + false -> "" + end + help_section = case function_exported?(cmd, :help_section, 0) do + true -> cmd.help_section() + false -> :other + end + {name, {description, help_section}} + end) + |> Enum.group_by(fn({name, {description, help_section}}) -> help_section end) + |> Enum.sort_by( + fn({help_section, _}) -> + ## TODO: sort help sections + case help_section do + :other -> 100 + :help -> 1 + _ -> 2 + end + end) + |> Enum.map( + fn({help_section, section_helps}) -> + [ + section_head(help_section) <> ":" | + Enum.sort(section_helps) + |> Enum.map( + fn({name, {description, _}}) -> + " #{String.pad_trailing(name, pad_commands_to)} #{description}" + end) + ] + + end) + |> Enum.concat() + end -Some commands accept an optional virtual host parameter for which -to display results. The default value is \"/\"."] + def section_head(help_section) do + case help_section do + :help -> + "Print this help and commad specific help" + :user_management -> + "User management" + :cluster_management -> + "Cluster management" + :node_management -> + "Node start/stop" + :queues -> + "Queue management" + :list -> + "List internal objects" + :vhost -> + "Vhost management" + :parameters -> + "Runtime parameters and policies" + :report -> + "Node status" + :trace -> + "Enable/disable tracing" + :encode -> + "Encoding/decoding" + :settings -> + "Node settings" + :feature_flags -> + "Feature flag management" + :other -> + "Other" + end end def commands() do @@ -187,14 +278,18 @@ to display results. The default value is \"/\"."] end end + defp help_additional(tool_name) do + ["Use '#{tool_name} help ' to get more info about a specific command"] + end + defp additional_usage() do [ - " - operation timeout in seconds. Default is \"infinity\".", - CommandModules.module_map() - |> Map.values() - |> Enum.filter(&:erlang.function_exported(&1, :usage_additional, 0)) - |> Enum.map(& &1.usage_additional) - |> Enum.join("\n\n") + # " - operation timeout in seconds. Default is \"infinity\".", + # CommandModules.module_map() + # |> Map.values() + # |> Enum.filter(&:erlang.function_exported(&1, :usage_additional, 0)) + # |> Enum.map(& &1.usage_additional) + # |> Enum.join("\n\n") ] end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/hipe_compile_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/hipe_compile_command.ex index 9232907d94..3d71140340 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/hipe_compile_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/hipe_compile_command.ex @@ -67,6 +67,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.HipeCompileCommand do def usage, do: "hipe_compile " + def description(), do: "Performs HiPE-compilation and caches resulting .beam-files in the given directory" + def banner([target_dir], _) do "Will pre-compile RabbitMQ server modules with HiPE to #{target_dir} ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/join_cluster_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/join_cluster_command.ex index 79255859b9..82ebe8f3c6 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/join_cluster_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/join_cluster_command.ex @@ -63,6 +63,10 @@ defmodule RabbitMQ.CLI.Ctl.Commands.JoinClusterCommand do "join_cluster [--disc|--ram] " end + def help_section(), do: :cluster_management + + def description(), do: "Join the cluster with the specified node" + def banner([target_node], %{node: node_name}) do "Clustering node #{node_name} with #{target_node}" end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_bindings_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_bindings_command.ex index 910cbb44c7..9278a3a071 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_bindings_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_bindings_command.ex @@ -69,6 +69,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListBindingsCommand do "list_bindings [-p ] [--no-table-headers] [ ...]" end + def help_section(), do: :list + def usage_additional() do " must be a member of the list [" <> Enum.join(@info_keys, ", ") <> "]." diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_channels_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_channels_command.ex index 736c077a94..27302dec7f 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_channels_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_channels_command.ex @@ -74,6 +74,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListChannelsCommand do "list_channels [--no-table-headers] [ ...]" end + def help_section(), do: :list + def usage_additional() do " must be a member of the list [" <> Enum.join(@info_keys, ", ") <> "]." diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_ciphers_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_ciphers_command.ex index 7c882b9fba..bde1bb7ba9 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_ciphers_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_ciphers_command.ex @@ -32,5 +32,9 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListCiphersCommand do def usage, do: "list_ciphers" + def help_section(), do: :encode + + def description(), do: "Lists cipher suites supported by encoding commands" + def banner(_, _), do: "Listing supported ciphers ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_connections_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_connections_command.ex index 5fcbd09176..cdc897e4e6 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_connections_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_connections_command.ex @@ -73,6 +73,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListConnectionsCommand do "list_connections [--no-table-headers] [ ...]" end + def help_section(), do: :list + def usage_additional() do " must be a member of the list [" <> Enum.join(@info_keys, ", ") <> "]." diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_consumers_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_consumers_command.ex index 1b4c652aee..f1bdd17148 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_consumers_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_consumers_command.ex @@ -71,6 +71,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListConsumersCommand do "list_consumers [-p vhost] [--no-table-headers] [ ...]" end + def help_section(), do: :list + def usage_additional() do " must be a member of the list [" <> Enum.join(@info_keys, ", ") <> "]." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_exchanges_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_exchanges_command.ex index 4144d4bb57..6fcdd75868 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_exchanges_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_exchanges_command.ex @@ -64,6 +64,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListExchangesCommand do "list_exchanges [-p ] [--no-table-headers] [ ...]" end + def help_section(), do: :list + def usage_additional() do " must be a member of the list [" <> Enum.join(@info_keys, ", ") <> "]." diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_feature_flags_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_feature_flags_command.ex index dad1be4fbf..bea92dc356 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_feature_flags_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_feature_flags_command.ex @@ -48,6 +48,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListFeatureFlagsCommand do def usage, do: "list_feature_flags [ ...]" + def help_section(), do: :feature_flags + def usage_additional() do " must be a member of the list [name, state, stability, provided_by, desc]." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_global_parameters_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_global_parameters_command.ex index 25b065fb91..972c92b286 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_global_parameters_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_global_parameters_command.ex @@ -42,5 +42,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListGlobalParametersCommand do def usage, do: "list_global_parameters [--no-table-headers]" + def help_section(), do: :parameters + def banner(_, _), do: "Listing global runtime parameters ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_hashes_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_hashes_command.ex index e1cf92085a..430ddacdfd 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_hashes_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_hashes_command.ex @@ -32,5 +32,9 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListHashesCommand do def usage, do: "list_hashes" + def help_section(), do: :encode + + def description(), do: "Lists hash functions supported by encoding commands" + def banner(_, _), do: "Listing supported hash algorithms ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_operator_policies_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_operator_policies_command.ex index 2709a3b0ea..cbb4a84bbc 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_operator_policies_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_operator_policies_command.ex @@ -41,6 +41,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListOperatorPoliciesCommand do def formatter(), do: RabbitMQ.CLI.Formatters.Table def usage, do: "list_operator_policies [-p ] [--no-table-headers]" + def help_section(), do: :parameters def banner(_, %{vhost: vhost}), do: "Listing operator policy overrides for vhost \"#{vhost}\" ..." diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_parameters_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_parameters_command.ex index 6782c58dc1..69dde3d0f4 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_parameters_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_parameters_command.ex @@ -41,6 +41,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListParametersCommand do def formatter(), do: RabbitMQ.CLI.Formatters.Table def usage, do: "list_parameters [-p ] [--no-table-headers]" + def help_section(), do: :parameters def banner(_, %{vhost: vhost}), do: "Listing runtime parameters for vhost \"#{vhost}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_permissions_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_permissions_command.ex index ed84676f08..8f488a1e28 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_permissions_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_permissions_command.ex @@ -41,6 +41,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListPermissionsCommand do def formatter(), do: RabbitMQ.CLI.Formatters.Table def usage, do: "list_permissions [-p ] [--no-table-headers]" + def help_section(), do: :user_management def banner(_, %{vhost: vhost}), do: "Listing permissions for vhost \"#{vhost}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_policies_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_policies_command.ex index 1edd8436f4..24f1f1fe2d 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_policies_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_policies_command.ex @@ -41,6 +41,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListPoliciesCommand do def formatter(), do: RabbitMQ.CLI.Formatters.Table def usage, do: "list_policies [-p ] [--no-table-headers]" + def help_section(), do: :parameters def banner(_, %{vhost: vhost}), do: "Listing policies for vhost \"#{vhost}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_queues_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_queues_command.ex index 2144cea376..b456419b2c 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_queues_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_queues_command.ex @@ -132,6 +132,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListQueuesCommand do "list_queues [-p ] [--online] [--offline] [--local] [--no-table-headers] [ ...]" end + def help_section(), do: :list + def usage_additional() do [" must be a member of the list [" <> Enum.join(@info_keys, ", ") <> "]."] end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_topic_permissions_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_topic_permissions_command.ex index 5e759d7bb3..95bce8b611 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_topic_permissions_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_topic_permissions_command.ex @@ -41,6 +41,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListTopicPermissionsCommand do def formatter(), do: RabbitMQ.CLI.Formatters.Table def usage, do: "list_topic_permissions [-p ] [--no-table-headers]" + def help_section(), do: :user_management def banner(_, %{vhost: vhost}), do: "Listing topic permissions for vhost \"#{vhost}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_unresponsive_queues_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_unresponsive_queues_command.ex index e6ca95064f..aa60aad4df 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_unresponsive_queues_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_unresponsive_queues_command.ex @@ -88,6 +88,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListUnresponsiveQueuesCommand do "list_unresponsive_queues [--local] [--queue-timeout ] [ ...] [--no-table-headers]" end + def help_section(), do: :list + def usage_additional() do " must be a member of the list [" <> Enum.join(@info_keys, ", ") <> "]." diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_user_permissions_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_user_permissions_command.ex index b133d1075c..ad68bf3825 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_user_permissions_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_user_permissions_command.ex @@ -44,6 +44,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListUserPermissionsCommand do end def usage, do: "list_user_permissions [--no-table-headers] " + def help_section(), do: :user_management def banner([username], _), do: "Listing permissions for user \"#{username}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_user_topic_permissions_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_user_topic_permissions_command.ex index 35c957100a..e9403406ca 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_user_topic_permissions_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_user_topic_permissions_command.ex @@ -41,6 +41,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListUserTopicPermissionsCommand do def formatter(), do: RabbitMQ.CLI.Formatters.Table def usage, do: "list_user_topic_permissions [--no-table-headers] " + def help_section(), do: :user_management def banner([username], _), do: "Listing topic permissions for user \"#{username}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_users_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_users_command.ex index 5bf81e8f72..be8e2044b0 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_users_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_users_command.ex @@ -35,6 +35,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListUsersCommand do def formatter(), do: RabbitMQ.CLI.Formatters.Table def usage, do: "list_users [--no-table-headers]" + def help_section(), do: :user_management def banner(_, _), do: "Listing users ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_vhost_limits_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_vhost_limits_command.ex index 9e64484544..ad5cfc4009 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_vhost_limits_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_vhost_limits_command.ex @@ -71,6 +71,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListVhostLimitsCommand do def usage, do: "list_vhost_limits [-p ] [--global] [--no-table-headers]" + def help_section(), do: :parameters + def banner([], %{global: true}) do "Listing limits for all vhosts ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_vhosts_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_vhosts_command.ex index 00f0b50da0..9ee94842cb 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_vhosts_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/list_vhosts_command.ex @@ -51,6 +51,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListVhostsCommand do end def usage, do: "list_vhosts [--no-table-headers] [ ...]" + def help_section(), do: :vhost def usage_additional() do " must be a member of the list [name, tracing, cluster_state]." diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/ping_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/ping_command.ex index bc28832627..557318d59b 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/ping_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/ping_command.ex @@ -66,6 +66,10 @@ defmodule RabbitMQ.CLI.Ctl.Commands.PingCommand do "ping" end + def help_section(), do: :node_management + + def description(), do: "Checks that the node process is running nad registered with EPMD" + def banner([], %{node: node_name, timeout: timeout}) when is_number(timeout) do "Will ping #{node_name}. This only checks if the OS process is running and registered with epmd. Timeout: #{ timeout diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/purge_queue_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/purge_queue_command.ex index 3f91688af1..c4e329aa69 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/purge_queue_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/purge_queue_command.ex @@ -45,6 +45,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.PurgeQueueCommand do def usage, do: "purge_queue " + def help_section(), do: :queues + def banner([queue], %{vhost: vhost}) do "Purging queue '#{queue}' in vhost '#{vhost}' ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/quorum_status_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/quorum_status_command.ex index 1de8e8a74d..62858a3d5f 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/quorum_status_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/quorum_status_command.ex @@ -40,6 +40,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.QuorumStatusCommand do "quorum_status [-p ] " end + def help_section(), do: :queues + def banner([name], %{node: node_name}), do: "Status of quorum queue #{name} on node #{node_name} ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/rename_cluster_node_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/rename_cluster_node_command.ex index 7564265f8c..c97d374d39 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/rename_cluster_node_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/rename_cluster_node_command.ex @@ -60,6 +60,10 @@ defmodule RabbitMQ.CLI.Ctl.Commands.RenameClusterNodeCommand do "rename_cluster_node [oldnode2] [newnode2] ..." end + def help_section(), do: :cluster_management + + def description(), do: "Rename cluster nodes in the local database" + def banner(args, _) do [ "Renaming cluster nodes: \n ", diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/report_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/report_command.ex index 67a2a177e2..6cf160a1d1 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/report_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/report_command.ex @@ -89,6 +89,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ReportCommand do def usage, do: "report" + def help_section(), do: :report + def banner(_, %{node: node_name}), do: "Reporting server status of node #{node_name} ..." # diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/reset_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/reset_command.ex index 74e13743c7..3713af704f 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/reset_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/reset_command.ex @@ -33,5 +33,9 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ResetCommand do def usage, do: "reset" + def help_section(), do: :node_management + + def description(), do: "Leave the cluster and return a RabbitMQ node to its virgin state" + def banner(_, %{node: node_name}), do: "Resetting node #{node_name} ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/restart_vhost_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/restart_vhost_command.ex index 760439db17..408d0ef888 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/restart_vhost_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/restart_vhost_command.ex @@ -30,6 +30,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.RestartVhostCommand do end def usage, do: "restart_vhost [-p ]" + def help_section(), do: :vhost def banner(_, %{node: node_name, vhost: vhost}) do "Trying to restart vhost '#{vhost}' on node '#{node_name}' ..." diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/rotate_logs_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/rotate_logs_command.ex index 8ab8185530..e2437af764 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/rotate_logs_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/rotate_logs_command.ex @@ -27,5 +27,9 @@ defmodule RabbitMQ.CLI.Ctl.Commands.RotateLogsCommand do def usage, do: "rotate_logs" + def help_section(), do: :node_management + + def description(), do: "Instructs the RabbitMQ node to perform internal log rotation" + def banner(_, %{node: node_name}), do: "Rotating logs for node #{node_name} ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_cluster_name_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_cluster_name_command.ex index 75be269568..69c47e5afd 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_cluster_name_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_cluster_name_command.ex @@ -36,4 +36,6 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetClusterNameCommand do end def usage, do: "set_cluster_name " + + def help_section(), do: :settings end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_disk_free_limit_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_disk_free_limit_command.ex index 1b61343bbf..bb1f581397 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_disk_free_limit_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_disk_free_limit_command.ex @@ -87,6 +87,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetDiskFreeLimitCommand do def usage, do: "set_disk_free_limit \nset_disk_free_limit mem_relative " + def help_section(), do: :settings + # # Implementation # diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_global_parameter_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_global_parameter_command.ex index 67ecebbb18..26559eb673 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_global_parameter_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_global_parameter_command.ex @@ -43,6 +43,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetGlobalParameterCommand do def usage, do: "set_global_parameter " + def help_section(), do: :parameters + def banner([name, value], _) do "Setting global runtime parameter \"#{name}\" to \"#{value}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_log_level_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_log_level_command.ex index e08b2ec9c4..bb904ad2e7 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_log_level_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_log_level_command.ex @@ -55,6 +55,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetLogLevelCommand do def usage, do: "set_log_level " + def help_section(), do: :settings + def banner([log_level], _), do: "Setting log level to \"#{log_level}\" ..." def output({:error, {:invalid_log_level, level}}, _opts) do diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_operator_policy_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_operator_policy_command.ex index c45c577d8e..9f68b24b6a 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_operator_policy_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_operator_policy_command.ex @@ -60,6 +60,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetOperatorPolicyCommand do do: "set_operator_policy [-p ] [--priority ] [--apply-to ] " + def help_section(), do: :parameters + def banner([name, pattern, definition], %{vhost: vhost, priority: priority}) do "Setting operator policy override \"#{name}\" for pattern \"#{pattern}\" to \"#{definition}\" with priority \"#{ priority diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_parameter_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_parameter_command.ex index b991cac6eb..048815911a 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_parameter_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_parameter_command.ex @@ -51,6 +51,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetParameterCommand do def usage, do: "set_parameter [-p ] " + def help_section(), do: :parameters + def banner([component_name, name, value], %{vhost: vhost}) do "Setting runtime parameter \"#{component_name}\" for component \"#{name}\" to \"#{value}\" in vhost \"#{ vhost diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_permissions_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_permissions_command.ex index 4daf8889b9..2962a98ca1 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_permissions_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_permissions_command.ex @@ -50,6 +50,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetPermissionsCommand do use RabbitMQ.CLI.DefaultOutput def usage, do: "set_permissions [-p ] " + def help_section(), do: :user_management def banner([user | _], %{vhost: vhost}), do: "Setting permissions for user \"#{user}\" in vhost \"#{vhost}\" ..." diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_policy_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_policy_command.ex index 56c76a8ed9..7bb6f49fa1 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_policy_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_policy_command.ex @@ -57,6 +57,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetPolicyCommand do do: "set_policy [-p ] [--priority ] [--apply-to ] " + def help_section(), do: :parameters + def banner([name, pattern, definition], %{vhost: vhost, priority: priority}) do "Setting policy \"#{name}\" for pattern \"#{pattern}\" to \"#{definition}\" with priority \"#{ priority diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_topic_permissions_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_topic_permissions_command.ex index aa261a1b1b..74d15f0596 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_topic_permissions_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_topic_permissions_command.ex @@ -46,6 +46,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetTopicPermissionsCommand do def usage, do: "set_topic_permissions [-p ] " + def help_section(), do: :user_management + def banner([user, exchange, _, _], %{vhost: vhost}), do: "Setting topic permissions on \"#{exchange}\" for user \"#{user}\" in vhost \"#{vhost}\" ..." diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_user_tags_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_user_tags_command.ex index 2e3f679ae1..082655ea5f 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_user_tags_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_user_tags_command.ex @@ -40,6 +40,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetUserTagsCommand do def usage, do: "set_user_tags [...]" + def help_section(), do: :user_management + def banner([user | tags], _) do "Setting tags for user \"#{user}\" to [#{tags |> Enum.join(", ")}] ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_vhost_limits_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_vhost_limits_command.ex index fc85347a52..e2e69d7a44 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_vhost_limits_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_vhost_limits_command.ex @@ -37,6 +37,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetVhostLimitsCommand do def usage, do: "set_vhost_limits [-p ] " + def help_section(), do: :parameters + def banner([definition], %{vhost: vhost}) do "Setting vhost limits to \"#{definition}\" for vhost \"#{vhost}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_vm_memory_high_watermark_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_vm_memory_high_watermark_command.ex index 561020ceaa..80eca5b9c8 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_vm_memory_high_watermark_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/set_vm_memory_high_watermark_command.ex @@ -112,6 +112,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SetVmMemoryHighWatermarkCommand do "set_vm_memory_high_watermark absolute " ] + def help_section(), do: :settings + def banner(["absolute", arg], %{node: node_name}) do "Setting memory threshold on #{node_name} to #{arg} bytes ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/shutdown_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/shutdown_command.ex index c9263ea01d..8a23c1b1ba 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/shutdown_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/shutdown_command.ex @@ -65,6 +65,10 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ShutdownCommand do def usage, do: "shutdown [--wait]" + def help_section(), do: :node_management + + def description(), do: "Stop the node and wait for the OS process to stop" + def banner(_, _), do: nil diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/start_app_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/start_app_command.ex index 65c0ed281f..848ffc1b69 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/start_app_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/start_app_command.ex @@ -26,5 +26,9 @@ defmodule RabbitMQ.CLI.Ctl.Commands.StartAppCommand do def usage, do: "start_app" + def help_section(), do: :node_management + + def description(), do: "Starts the RabbitMQ application inside the Erlang VM node" + def banner(_, %{node: node_name}), do: "Starting node #{node_name} ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/status_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/status_command.ex index 29c128d836..f70353d30e 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/status_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/status_command.ex @@ -31,5 +31,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.StatusCommand do def usage, do: "status" + def help_section(), do: :report + def banner(_, %{node: node_name}), do: "Status of node #{node_name} ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/stop_app_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/stop_app_command.ex index 3d0f4acc73..10e9fec6d3 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/stop_app_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/stop_app_command.ex @@ -27,5 +27,9 @@ defmodule RabbitMQ.CLI.Ctl.Commands.StopAppCommand do def usage, do: "stop_app" + def help_section(), do: :node_management + + def description(), do: "Stops the RabbitMQ application, leaving the runtme (Erlang VM) running" + def banner(_, %{node: node_name}), do: "Stopping rabbit application on node #{node_name} ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/stop_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/stop_command.ex index 013d365ede..100f936683 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/stop_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/stop_command.ex @@ -61,6 +61,10 @@ defmodule RabbitMQ.CLI.Ctl.Commands.StopCommand do def usage, do: "stop [--idempotent] []" + def description(), do: "Stop the node" + + def help_section(), do: :node_management + def banner([pidfile_path], %{node: node_name}) do "Stopping and halting node #{node_name} (will monitor pid file #{pidfile_path}) ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/sync_queue_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/sync_queue_command.ex index 008db1b3b9..7a0aa85ef2 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/sync_queue_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/sync_queue_command.ex @@ -37,6 +37,8 @@ defmodule RabbitMQ.CLI.Ctl.Commands.SyncQueueCommand do def usage, do: "sync_queue [-p ] queue" + def help_section(), do: :queues + def banner([queue], %{vhost: vhost, node: _node}) do "Synchronising queue '#{queue}' in vhost '#{vhost}' ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/trace_off_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/trace_off_command.ex index d4318a1cf0..cae0b99ce0 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/trace_off_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/trace_off_command.ex @@ -34,5 +34,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.TraceOffCommand do def usage, do: "trace_off [-p ]" + def help_section(), do: :trace + def banner(_, %{vhost: vhost}), do: "Stopping tracing for vhost \"#{vhost}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/trace_on_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/trace_on_command.ex index 6c0d6b0ae6..0f723816c3 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/trace_on_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/trace_on_command.ex @@ -34,5 +34,7 @@ use RabbitMQ.CLI.DefaultOutput def usage, do: "trace_on [-p ]" + def help_section(), do: :trace + def banner(_, %{vhost: vhost}), do: "Starting tracing for vhost \"#{vhost}\" ..." end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/update_cluster_nodes_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/update_cluster_nodes_command.ex index ee11af95bd..6792f99045 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/update_cluster_nodes_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/update_cluster_nodes_command.ex @@ -37,6 +37,10 @@ defmodule RabbitMQ.CLI.Ctl.Commands.UpdateClusterNodesCommand do "update_cluster_nodes " end + def help_section(), do: :cluster_management + + def description(), do: "Instructs an already clustered node to contact to cluster when waking up" + def banner([seed_node], %{node: node_name}) do "Will seed #{node_name} from #{seed_node} on next start" end diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/wait_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/wait_command.ex index 92263f1d13..c2c88dd765 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/wait_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/wait_command.ex @@ -75,6 +75,10 @@ defmodule RabbitMQ.CLI.Ctl.Commands.WaitCommand do def usage, do: "wait [] [--pid|-P ]" + def help_section(), do: :node_management + + def description(), do: "Waits for the RabbitMQ application to start" + ## Banners are included in wait steps def banner(_, _), do: nil diff --git a/deps/rabbitmq_cli/lib/rabbitmqctl.ex b/deps/rabbitmq_cli/lib/rabbitmqctl.ex index 416ea44ff7..468f80f775 100644 --- a/deps/rabbitmq_cli/lib/rabbitmqctl.ex +++ b/deps/rabbitmq_cli/lib/rabbitmqctl.ex @@ -159,6 +159,7 @@ defmodule RabbitMQCtl do command.run(arguments, options) |> command.output(options) catch _error_type, error -> + IO.puts(:erlang.get_stacktrace()) format_error(error, options, command) end end -- cgit v1.2.1