Add stub for usage message.
This commit is contained in:
parent
a843b837d8
commit
a2be29a556
|
@ -17,6 +17,10 @@ defmodule CLI do
|
|||
:net_kernel.stop()
|
||||
end
|
||||
|
||||
defp print_usage() do
|
||||
IO.puts "Usage: TBD"
|
||||
end
|
||||
|
||||
defp print_nodedown_error(options) do
|
||||
target_node = options[:node] || get_rabbit_hostname
|
||||
|
||||
|
@ -24,6 +28,7 @@ defmodule CLI do
|
|||
IO.puts "Error: unable to connect to node '#{target_node}': nodedown"
|
||||
end
|
||||
|
||||
defp run_command([], _), do: IO.puts print_usage
|
||||
defp run_command(["status"], options) do
|
||||
case result = status(options) do
|
||||
{:badrpc, :nodedown} -> print_nodedown_error(options)
|
||||
|
|
|
@ -27,4 +27,12 @@ defmodule CLITest do
|
|||
command = ["status", "-n", "sandwich@pastrami"]
|
||||
assert capture_io(fn -> CLI.main(command) end) =~ ~r/unable to connect to node 'sandwich@pastrami'\: nodedown/
|
||||
end
|
||||
|
||||
test "Empty command shows usage message" do
|
||||
assert capture_io(fn -> CLI.main([]) end) =~ ~r/Usage\:/
|
||||
end
|
||||
|
||||
test "Empty command with options shows usage message" do
|
||||
assert capture_io(fn -> CLI.main(["-n", "sandwich@pastrami"]) end) =~ ~r/Usage\:/
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue