1## This Source Code Form is subject to the terms of the Mozilla Public
2## License, v. 2.0. If a copy of the MPL was not distributed with this
3## file, You can obtain one at https://mozilla.org/MPL/2.0/.
4##
5## Copyright (c) 2007-2021 VMware, Inc. or its affiliates.  All rights reserved.
6
7defmodule RabbitMQ.CLI.Diagnostics.Commands.CommandLineArgumentsCommand do
8  alias RabbitMQ.CLI.Core.DocGuide
9  @behaviour RabbitMQ.CLI.CommandBehaviour
10
11  def scopes(), do: [:diagnostics]
12
13  use RabbitMQ.CLI.Core.MergesNoDefaults
14
15  def validate(_, %{formatter: "json"}) do
16    {:validation_failure, :unsupported_formatter}
17  end
18  use RabbitMQ.CLI.Core.AcceptsNoPositionalArguments
19
20  def run([], %{node: node_name}) do
21    :rabbit_misc.rpc_call(node_name, :init, :get_arguments, [])
22  end
23  use RabbitMQ.CLI.DefaultOutput
24
25  def formatter(), do: RabbitMQ.CLI.Formatters.Erlang
26
27  def usage, do: "command_line_arguments"
28
29  def usage_doc_guides() do
30    [
31      DocGuide.configuration(),
32      DocGuide.monitoring()
33    ]
34  end
35
36  def help_section(), do: :configuration
37
38  def description(), do: "Displays target node's command-line arguments and flags as reported by the runtime"
39
40  def banner(_, %{node: node_name}), do: "Command line arguments of node #{node_name} ..."
41end
42