Colorize ui output
This commit is contained in:
parent
a718e228a4
commit
55e89ed372
@ -17,6 +17,12 @@ module Vagrant
|
||||
class Remote < Basic
|
||||
attr_reader :client
|
||||
|
||||
COLOR_TO_STYLE = {
|
||||
red: :error,
|
||||
green: :success,
|
||||
yellow: :warn
|
||||
}
|
||||
|
||||
def initialize(client)
|
||||
super()
|
||||
@client = client
|
||||
@ -35,6 +41,9 @@ module Vagrant
|
||||
|
||||
def safe_puts(message, **opts)
|
||||
message, extra_opts = message
|
||||
if !extra_opts[:color].nil?
|
||||
extra_opts[:style] = COLOR_TO_STYLE[extra_opts[:color]]
|
||||
end
|
||||
opts = {
|
||||
new_line: opts[:printer] == :puts,
|
||||
style: extra_opts[:style],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user