2020-07-12 02:23:07 +08:00
|
|
|
## This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
## License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
## file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
2016-08-18 21:56:21 +08:00
|
|
|
##
|
2021-02-14 05:54:01 +08:00
|
|
|
## Copyright (c) 2007-2021 VMware, Inc. or its affiliates. All rights reserved.
|
2016-08-18 21:56:21 +08:00
|
|
|
|
2016-08-22 19:58:37 +08:00
|
|
|
defmodule RabbitMQ.CLI.Printers.StdIO do
|
2016-11-16 21:46:36 +08:00
|
|
|
@behaviour RabbitMQ.CLI.PrinterBehaviour
|
2016-08-18 21:56:21 +08:00
|
|
|
|
2016-08-22 21:13:38 +08:00
|
|
|
def init(_), do: {:ok, :ok}
|
|
|
|
|
def finish(_), do: :ok
|
2016-08-18 21:56:21 +08:00
|
|
|
|
2016-08-22 21:13:38 +08:00
|
|
|
def print_output(nil, _), do: :ok
|
2019-01-31 03:20:29 +08:00
|
|
|
|
2016-11-10 02:18:19 +08:00
|
|
|
def print_output(output, _) when is_list(output) do
|
|
|
|
|
for line <- output do
|
|
|
|
|
IO.puts(line)
|
|
|
|
|
end
|
|
|
|
|
end
|
2019-01-31 03:20:29 +08:00
|
|
|
|
2016-08-18 21:56:21 +08:00
|
|
|
def print_output(output, _) do
|
2016-08-22 19:58:37 +08:00
|
|
|
IO.puts(output)
|
2016-08-18 21:56:21 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def print_ok(_) do
|
|
|
|
|
:ok
|
|
|
|
|
end
|
2017-01-10 22:42:40 +08:00
|
|
|
end
|