Make RABBITMQ_ERLANG_COOKIE deprecation message pop [as in colors]

This commit is contained in:
Michael Klishin 2020-07-03 09:05:35 +07:00
parent d7ca0e9446
commit 4f80dd1369
2 changed files with 21 additions and 3 deletions

View File

@ -17,4 +17,20 @@ defmodule RabbitMQ.CLI.Core.ANSI do
def bright(string) do
"#{IO.ANSI.bright()}#{string}#{IO.ANSI.reset()}"
end
def red(string) do
"#{IO.ANSI.red()}#{string}#{IO.ANSI.reset()}"
end
def yellow(string) do
"#{IO.ANSI.yellow()}#{string}#{IO.ANSI.reset()}"
end
def bright_red(string) do
"#{IO.ANSI.bright()}#{IO.ANSI.red()}#{string}#{IO.ANSI.reset()}"
end
def bright_yellow(string) do
"#{IO.ANSI.bright()}#{IO.ANSI.yellow()}#{string}#{IO.ANSI.reset()}"
end
end

View File

@ -14,7 +14,7 @@
## Copyright (c) 2016-2020 VMware, Inc. or its affiliates. All rights reserved.
defmodule RabbitMQ.CLI.Core.Distribution do
alias RabbitMQ.CLI.Core.{Config, Helpers}
alias RabbitMQ.CLI.Core.{ANSI, Config, Helpers}
#
# API
@ -118,8 +118,10 @@ defmodule RabbitMQ.CLI.Core.Distribution do
case Config.output_less?(options) do
true -> :ok
false ->
IO.puts("RABBITMQ_ERLANG_COOKIE env variable support is deprecated and will be REMOVED in a future version. " <>
"Use the $HOME/.erlang.cookie file or the --erlang-cookie switch instead.")
warning = ANSI.bright_red("RABBITMQ_ERLANG_COOKIE env variable support is deprecated and will be REMOVED in a future version. ") <>
ANSI.yellow("Use the $HOME/.erlang.cookie file or the --erlang-cookie switch instead.")
IO.puts(warning)
end
end
end