mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
feature #1353: state is only colored when using a tty
This commit is contained in:
parent
d9cf939ea3
commit
8337da960b
@ -98,11 +98,15 @@ module CLIHelper
|
||||
BAD_STATES=%w{fail err err}
|
||||
|
||||
def CLIHelper.color_state(stat)
|
||||
case stat.strip
|
||||
when *OK_STATES
|
||||
ANSI_GREEN+stat+ANSI_RESET
|
||||
when *BAD_STATES
|
||||
ANSI_RED+stat+ANSI_RESET
|
||||
if $stdout.tty?
|
||||
case stat.strip
|
||||
when *OK_STATES
|
||||
ANSI_GREEN+stat+ANSI_RESET
|
||||
when *BAD_STATES
|
||||
ANSI_RED+stat+ANSI_RESET
|
||||
else
|
||||
stat
|
||||
end
|
||||
else
|
||||
stat
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user