From 171376f9c9f636d6e22a77762fc5f141292b38b1 Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Sat, 30 Mar 2019 09:30:26 +0300 Subject: [PATCH] Document arguments/options and relevant guides for more commands --- deps/rabbitmq_cli/DESIGN.md | 2 +- .../lib/rabbitmq/cli/core/doc_guide.ex | 6 ++++++ .../cli/ctl/commands/add_user_command.ex | 8 +++++++- .../cli/ctl/commands/add_vhost_command.ex | 14 ++++++++++++- .../ctl/commands/authenticate_user_command.ex | 7 +++++++ .../ctl/commands/cancel_sync_queue_command.ex | 16 ++++++++++++++- .../change_cluster_node_type_command.ex | 16 ++++++++++++++- .../ctl/commands/change_password_command.ex | 15 +++++++++++++- .../ctl/commands/clear_password_command.ex | 17 ++++++++++++++-- .../ctl/commands/clear_permissions_command.ex | 9 +++++++-- .../cli/ctl/commands/clear_policy_command.ex | 2 +- .../clear_topic_permissions_command.ex | 18 +++++++++++++++-- .../commands/clear_vhost_limits_command.ex | 8 +++++++- .../commands/close_all_connections_command.ex | 10 +++++++++- .../ctl/commands/close_connection_command.ex | 15 ++++++++++++++ .../ctl/commands/cluster_status_command.ex | 10 ++++++++++ .../cli/ctl/commands/decode_command.ex | 12 +++++++++-- .../cli/ctl/commands/delete_queue_command.ex | 7 +++++++ .../cli/ctl/commands/delete_user_command.ex | 17 ++++++++++++++-- .../cli/ctl/commands/delete_vhost_command.ex | 14 ++++++++++++- .../cli/ctl/commands/encode_command.ex | 8 +++++++- .../rabbitmq/cli/ctl/commands/eval_command.ex | 20 +++++++++++++++++-- .../rabbitmq/cli/ctl/commands/exec_command.ex | 16 ++++++++++++--- .../ctl/commands/list_consumers_command.ex | 2 +- 24 files changed, 242 insertions(+), 27 deletions(-) diff --git a/deps/rabbitmq_cli/DESIGN.md b/deps/rabbitmq_cli/DESIGN.md index b4725949c5..4179048159 100644 --- a/deps/rabbitmq_cli/DESIGN.md +++ b/deps/rabbitmq_cli/DESIGN.md @@ -158,7 +158,7 @@ Then the alias can be called like this: ``` rabbitmqctl delete_vhost_queues -p vhost1 # or -rabbitmqctl delete_vhost_queues ---vhost vhost1 +rabbitmqctl delete_vhost_queues ---vhost 1 ``` Keep in mind that `eval` command can accept only [global arguments](#global-arguments) as named, diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/core/doc_guide.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/core/doc_guide.ex index 17c3769731..dde92a53d0 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/core/doc_guide.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/core/doc_guide.ex @@ -41,11 +41,15 @@ defmodule RabbitMQ.CLI.Core.DocGuide do # API # + Macros.defguide("access_control") Macros.defguide("alternate_exchange", path_segment: "ae") + Macros.defguide("cli") Macros.defguide("clustering") Macros.defguide("cluster_formation") + Macros.defguide("connections") Macros.defguide("configuration", path_segment: "configure") Macros.defguide("consumers") + Macros.defguide("mirroring", path_segment: "ha") Macros.defguide("logging") Macros.defguide("management") Macros.defguide("monitoring") @@ -53,4 +57,6 @@ defmodule RabbitMQ.CLI.Core.DocGuide do Macros.defguide("plugins") Macros.defguide("queues") Macros.defguide("quorum_queues", domain: "next.rabbitmq.com") + Macros.defguide("troubleshooting") + Macros.defguide("virtual_hosts", path_segments: "vhosts") end 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 25a2f54628..d68534e1ae 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 @@ -14,7 +14,7 @@ ## Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. defmodule RabbitMQ.CLI.Ctl.Commands.AddUserCommand do - alias RabbitMQ.CLI.Core.{ExitCodes, Helpers} + alias RabbitMQ.CLI.Core.{DocGuide, ExitCodes, Helpers} @behaviour RabbitMQ.CLI.CommandBehaviour @@ -54,6 +54,12 @@ defmodule RabbitMQ.CLI.Ctl.Commands.AddUserCommand do ] end + def usage_doc_guides() do + [ + DocGuide.access_control() + ] + end + def help_section(), do: :user_management def description(), do: "Creates a new user in the internal database" 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 52cce88dba..96990be996 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 @@ -14,7 +14,7 @@ ## Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. defmodule RabbitMQ.CLI.Ctl.Commands.AddVhostCommand do - alias RabbitMQ.CLI.Core.Helpers + alias RabbitMQ.CLI.Core.{DocGuide, Helpers} @behaviour RabbitMQ.CLI.CommandBehaviour @@ -30,6 +30,18 @@ defmodule RabbitMQ.CLI.Ctl.Commands.AddVhostCommand do def usage, do: "add_vhost " + def usage_additional() do + [ + ["", "Virtual host name"] + ] + end + + def usage_doc_guides() do + [ + DocGuide.virtual_hosts() + ] + end + def help_section(), do: :virtual_hosts def description(), do: "Creates a virtual host" 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 20580b1619..24b866eb6a 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 @@ -14,6 +14,8 @@ ## Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. defmodule RabbitMQ.CLI.Ctl.Commands.AuthenticateUserCommand do + alias RabbitMQ.CLI.Core.DocGuide + @behaviour RabbitMQ.CLI.CommandBehaviour def merge_defaults(args, opts), do: {args, opts} @@ -42,6 +44,11 @@ defmodule RabbitMQ.CLI.Ctl.Commands.AuthenticateUserCommand do ] end + def usage_doc_guides() do + [ + DocGuide.access_control() + ] + end def help_section(), do: :user_management 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 745d9c0226..fef70c97aa 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 @@ -14,6 +14,8 @@ ## Copyright (c) 2016-2017 Pivotal Software, Inc. All rights reserved. defmodule RabbitMQ.CLI.Ctl.Commands.CancelSyncQueueCommand do + alias RabbitMQ.CLI.Core.DocGuide + @behaviour RabbitMQ.CLI.CommandBehaviour use RabbitMQ.CLI.DefaultOutput @@ -35,7 +37,19 @@ defmodule RabbitMQ.CLI.Ctl.Commands.CancelSyncQueueCommand do ) end - def usage, do: "cancel_sync_queue [--vhost ] queue" + def usage, do: "cancel_sync_queue [--vhost ] " + + def usage_additional() do + [ + ["", "Queue name"] + ] + end + + def usage_doc_guides() do + [ + DocGuide.mirroring() + ] + end def help_section(), do: :replication 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 00dc95af88..c4a5b163bf 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 @@ -14,6 +14,8 @@ ## Copyright (c) 2016-2017 Pivotal Software, Inc. All rights reserved. defmodule RabbitMQ.CLI.Ctl.Commands.ChangeClusterNodeTypeCommand do + alias RabbitMQ.CLI.Core.DocGuide + @behaviour RabbitMQ.CLI.CommandBehaviour def merge_defaults(args, opts) do @@ -50,7 +52,19 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ChangeClusterNodeTypeCommand do end def usage() do - "change_cluster_node_type " + "change_cluster_node_type " + end + + def usage_additional() do + [ + ["", "New node type"] + ] + end + + def usage_doc_guides() do + [ + DocGuide.clustering() + ] end def help_section(), do: :cluster_management 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 8c5fec3397..bed3f90b97 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 @@ -14,7 +14,7 @@ ## Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. defmodule RabbitMQ.CLI.Ctl.Commands.ChangePasswordCommand do - alias RabbitMQ.CLI.Core.Helpers + alias RabbitMQ.CLI.Core.{DocGuide, Helpers} @behaviour RabbitMQ.CLI.CommandBehaviour use RabbitMQ.CLI.DefaultOutput @@ -37,6 +37,19 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ChangePasswordCommand do def usage, do: "change_password " + def usage_additional() do + [ + ["", "Name of the user whose password should be changed"], + ["", "New password to set"] + ] + end + + def usage_doc_guides() do + [ + DocGuide.access_control() + ] + end + def help_section(), do: :user_management def description(), do: "Changes the user password" 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 09220fba26..6c1040ccde 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 @@ -14,7 +14,7 @@ ## Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. defmodule RabbitMQ.CLI.Ctl.Commands.ClearPasswordCommand do - alias RabbitMQ.CLI.Core.Helpers + alias RabbitMQ.CLI.Core.{DocGuide, Helpers} @behaviour RabbitMQ.CLI.CommandBehaviour @@ -34,9 +34,22 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearPasswordCommand do use RabbitMQ.CLI.DefaultOutput def usage, do: "clear_password " + + def usage_additional() do + [ + ["", "Name of the user whose password should be cleared"] + ] + end + + def usage_doc_guides() do + [ + DocGuide.access_control() + ] + end + def help_section(), do: :user_management - def description(), do: "Removes the user password" + def description(), do: "Clears (resets) password and disables password login for a user" 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 05c16bcc8b..548a0aa2ef 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 @@ -14,7 +14,7 @@ ## Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. defmodule RabbitMQ.CLI.Ctl.Commands.ClearPermissionsCommand do - alias RabbitMQ.CLI.Core.Helpers + alias RabbitMQ.CLI.Core.{DocGuide, Helpers} @behaviour RabbitMQ.CLI.CommandBehaviour @@ -35,7 +35,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearPermissionsCommand do use RabbitMQ.CLI.DefaultOutput - def usage, do: "clear_permissions [-p vhost] " + def usage, do: "clear_permissions [--vhost ] " def usage_additional() do [ @@ -43,6 +43,11 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearPermissionsCommand do ] end + def usage_doc_guides() do + [ + DocGuide.access_control() + ] + end def help_section(), do: :access_control def description(), do: "Revokes user permissions for a 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 41606301cd..1894b26250 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 @@ -38,7 +38,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearPolicyCommand do def usage_additional() do [ - ["", "name of policy to clear (remove)"] + ["", "Name of policy to clear (remove)"] ] 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 0178dd5204..14a82aedbc 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 @@ -14,7 +14,7 @@ ## Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. defmodule RabbitMQ.CLI.Ctl.Commands.ClearTopicPermissionsCommand do - alias RabbitMQ.CLI.Core.Helpers + alias RabbitMQ.CLI.Core.{DocGuide, Helpers} @behaviour RabbitMQ.CLI.CommandBehaviour use RabbitMQ.CLI.DefaultOutput @@ -53,7 +53,21 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearTopicPermissionsCommand do ]) end - def usage, do: "clear_topic_permissions [-p vhost] []" + def usage, do: "clear_topic_permissions [--vhost ] []" + + def usage_additional() do + [ + ["", "Name of the user whose topic permissions should be revoked"], + ["", "Exchange the permissions are for"] + ] + end + + def usage_doc_guides() do + [ + DocGuide.access_control() + ] + end + def help_section(), do: :access_control def description(), do: "Clears user topic permissions for a vhost or exchange" 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 ea80f5b98d..3127b142cc 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 @@ -14,7 +14,7 @@ ## Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. defmodule RabbitMQ.CLI.Ctl.Commands.ClearVhostLimitsCommand do - alias RabbitMQ.CLI.Core.Helpers + alias RabbitMQ.CLI.Core.{DocGuide, Helpers} @behaviour RabbitMQ.CLI.CommandBehaviour use RabbitMQ.CLI.DefaultOutput @@ -36,6 +36,12 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClearVhostLimitsCommand do def usage, do: "clear_vhost_limits [--vhost ]" + def usage_doc_guides() do + [ + DocGuide.virtual_hosts() + ] + end + def help_section(), do: :virtual_hosts def description(), do: "Clears virtual host limits" diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/close_all_connections_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/close_all_connections_command.ex index 6377071e2b..0db70fb03f 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/close_all_connections_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/close_all_connections_command.ex @@ -14,6 +14,8 @@ ## Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. defmodule RabbitMQ.CLI.Ctl.Commands.CloseAllConnectionsCommand do + alias RabbitMQ.CLI.Core.DocGuide + @behaviour RabbitMQ.CLI.CommandBehaviour def switches(), do: [global: :boolean, per_connection_delay: :integer, limit: :integer] @@ -78,7 +80,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.CloseAllConnectionsCommand do end def usage do - "close_all_connections [-p --limit ] [-n --global] [--per-connection-delay ] " + "close_all_connections [--vhost --limit ] [-n --global] [--per-connection-delay ] " end def usage_additional do @@ -89,6 +91,12 @@ defmodule RabbitMQ.CLI.Ctl.Commands.CloseAllConnectionsCommand do ] end + def usage_doc_guides() do + [ + DocGuide.connections() + ] + end + def help_section(), do: :operations def description(), do: "Instructs the broker to close all connections for the specified vhost or entire RabbitMQ node" diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/close_connection_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/close_connection_command.ex index ea503ce0d4..49fdb006c1 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/close_connection_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/close_connection_command.ex @@ -14,6 +14,8 @@ ## Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. defmodule RabbitMQ.CLI.Ctl.Commands.CloseConnectionCommand do + alias RabbitMQ.CLI.Core.DocGuide + @behaviour RabbitMQ.CLI.CommandBehaviour use RabbitMQ.CLI.Core.MergesNoDefaults @@ -32,6 +34,19 @@ defmodule RabbitMQ.CLI.Ctl.Commands.CloseConnectionCommand do def usage, do: "close_connection " + def usage_additional do + [ + ["", "connection identifier (Erlang PID), see list_connections"], + ["", "reason for connection closure"] + ] + end + + def usage_doc_guides() do + [ + DocGuide.connections() + ] + end + def help_section(), do: :operations def description(), do: "Instructs the broker to close the connection associated with the Erlang process id" 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 2d5b773ccf..4a226d2698 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 @@ -14,6 +14,8 @@ ## Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. defmodule RabbitMQ.CLI.Ctl.Commands.ClusterStatusCommand do + alias RabbitMQ.CLI.Core.DocGuide + @behaviour RabbitMQ.CLI.CommandBehaviour def scopes(), do: [:ctl, :diagnostics] @@ -48,6 +50,14 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ClusterStatusCommand do def usage, do: "cluster_status" + def usage_doc_guides() do + [ + DocGuide.clustering(), + DocGuide.cluster_formation(), + DocGuide.monitoring() + ] + end + def help_section(), do: :cluster_management def description(), do: "Displays all the nodes in the cluster grouped by node type, together with the currently running nodes" 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 e5962a9344..56bc75c037 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 @@ -16,6 +16,8 @@ alias RabbitMQ.CLI.Core.Helpers defmodule RabbitMQ.CLI.Ctl.Commands.DecodeCommand do + alias RabbitMQ.CLI.Core.DocGuide + @behaviour RabbitMQ.CLI.CommandBehaviour use RabbitMQ.CLI.DefaultOutput @@ -42,7 +44,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.DecodeCommand do end def validate(args, _) when length(args) < 2 do - {:validation_failure, {:bad_argument, "Please provide a value to decode and a passphrase."}} + {:validation_failure, {:bad_argument, "Please provide a value to decode and a passphrase"}} end def validate(args, _) when length(args) > 2 do @@ -52,7 +54,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.DecodeCommand do def validate(args, opts) when length(args) === 2 do case {supports_cipher(opts.cipher), supports_hash(opts.hash), opts.iterations > 0} do {false, _, _} -> - {:validation_failure, {:bad_argument, "The requested cipher is not supported."}} + {:validation_failure, {:bad_argument, "The requested cipher is not supported"}} {_, false, _} -> {:validation_failure, {:bad_argument, "The requested hash is not supported"}} @@ -104,6 +106,12 @@ defmodule RabbitMQ.CLI.Ctl.Commands.DecodeCommand do ] end + def usage_doc_guides() do + [ + DocGuide.configuration() + ] + end + def help_section(), do: :configuration def description(), do: "Decrypts an encrypted configuration value" 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 8a0f0661a8..5fc29ad4b5 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 @@ -14,6 +14,8 @@ ## Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. defmodule RabbitMQ.CLI.Ctl.Commands.DeleteQueueCommand do + alias RabbitMQ.CLI.Core.DocGuide + @behaviour RabbitMQ.CLI.CommandBehaviour def switches(), do: [if_empty: :boolean, if_unused: :boolean, timeout: :integer] @@ -119,6 +121,11 @@ defmodule RabbitMQ.CLI.Ctl.Commands.DeleteQueueCommand do ] end + def usage_doc_guides() do + [ + DocGuide.queues() + ] + end def help_section(), do: :queues 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 78516ba7f2..1c8701643a 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 @@ -14,7 +14,7 @@ ## Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. defmodule RabbitMQ.CLI.Ctl.Commands.DeleteUserCommand do - alias RabbitMQ.CLI.Core.Helpers + alias RabbitMQ.CLI.Core.{DocGuide, Helpers} @behaviour RabbitMQ.CLI.CommandBehaviour @@ -34,9 +34,22 @@ defmodule RabbitMQ.CLI.Ctl.Commands.DeleteUserCommand do use RabbitMQ.CLI.DefaultOutput def usage, do: "delete_user " + + def usage_additional() do + [ + ["", "Name of the user to delete."] + ] + end + + def usage_doc_guides() do + [ + DocGuide.queues() + ] + end + def help_section(), do: :user_management - def description(), do: "Removes the specified user" + def description(), do: "Removes a user from the internal database. Has no effect on users provided by external backends such as LDAP" 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 332951a1ff..0cf02e927e 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 @@ -14,7 +14,7 @@ ## Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. defmodule RabbitMQ.CLI.Ctl.Commands.DeleteVhostCommand do - alias RabbitMQ.CLI.Core.Helpers + alias RabbitMQ.CLI.Core.{DocGuide, Helpers} @behaviour RabbitMQ.CLI.CommandBehaviour @@ -30,6 +30,18 @@ defmodule RabbitMQ.CLI.Ctl.Commands.DeleteVhostCommand do def usage, do: "delete_vhost " + def usage_additional() do + [ + ["", "Name of the virtual host to delete."] + ] + end + + def usage_doc_guides() do + [ + DocGuide.virtual_hosts() + ] + end + def help_section(), do: :virtual_hosts def description(), do: "Deletes a virtual host" 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 ae8e56104f..5fdc06fa99 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 @@ -14,7 +14,7 @@ ## Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. defmodule RabbitMQ.CLI.Ctl.Commands.EncodeCommand do - alias RabbitMQ.CLI.Core.Helpers + alias RabbitMQ.CLI.Core.{DocGuide, Helpers} @behaviour RabbitMQ.CLI.CommandBehaviour use RabbitMQ.CLI.DefaultOutput @@ -94,6 +94,12 @@ defmodule RabbitMQ.CLI.Ctl.Commands.EncodeCommand do ] end + def usage_doc_guides() do + [ + DocGuide.configuration() + ] + end + def help_section(), do: :configuration def description(), do: "Encrypts a sensitive configuration value" diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/eval_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/eval_command.ex index 5bdd81bba1..9e56e3a099 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/eval_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/eval_command.ex @@ -14,6 +14,8 @@ ## Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. defmodule RabbitMQ.CLI.Ctl.Commands.EvalCommand do + alias RabbitMQ.CLI.Core.DocGuide + @behaviour RabbitMQ.CLI.CommandBehaviour use RabbitMQ.CLI.Core.MergesNoDefaults @@ -47,11 +49,25 @@ defmodule RabbitMQ.CLI.Ctl.Commands.EvalCommand do def formatter(), do: RabbitMQ.CLI.Formatters.Erlang - def usage, do: "eval " + def usage, do: "eval " + + def usage_additional() do + [ + ["", "Expression to evaluate"] + ] + end + + def usage_doc_guides() do + [ + DocGuide.cli(), + DocGuide.monitoring(), + DocGuide.troubleshooting() + ] + end def help_section(), do: :operations - def description(), do: "Executes Erlang code on the RabbitMQ node" + def description(), do: "Evaluates a snippet of Erlang code on the target node" def banner(_, _), do: nil diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/exec_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/exec_command.ex index d5a9608ea3..13784a6d95 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/exec_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/exec_command.ex @@ -14,6 +14,8 @@ ## Copyright (c) 2007-2019 Pivotal Software, Inc. All rights reserved. defmodule RabbitMQ.CLI.Ctl.Commands.ExecCommand do + alias RabbitMQ.CLI.Core.DocGuide + @behaviour RabbitMQ.CLI.CommandBehaviour use RabbitMQ.CLI.Core.MergesNoDefaults @@ -64,16 +66,24 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ExecCommand do def banner(_, _), do: nil - def usage, do: "exec [--offline]" + def usage, do: "exec [--offline]" def usage_additional() do [ - ["--offline", "do not initialize Erlang distribution"] + ["", "Expression to evaluate"], + ["--offline", "disable inter-node communication"] ] end + def usage_doc_guides() do + [ + DocGuide.cli(), + DocGuide.monitoring(), + DocGuide.troubleshooting() + ] + end def help_section(), do: :operations - def description(), do: "Executes Elixir code on the CLI node" + def description(), do: "Evaluates a snippet of Elixir code on the CLI node" end 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 9c5958492d..eabf5978c4 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 @@ -68,7 +68,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.ListConsumersCommand do def formatter(), do: RabbitMQ.CLI.Formatters.Table def usage() do - "list_consumers [-p vhost] [--no-table-headers] [ ...]" + "list_consumers [--vhost ] [--no-table-headers] [ ...]" end def help_section(), do: :observability_and_health_checks