class RBS::CLI::ColoredIO
def are_colors_disabled?
def are_colors_disabled? !ENV['NO_COLOR'].nil? && !ENV.fetch('NO_COLOR', '').empty? end
def are_colors_supported?
def are_colors_supported? stdout.tty? && ENV["TERM"] != "dumb" end
def can_display_colors?
def can_display_colors? are_colors_supported? && !are_colors_disabled? end
def initialize(stdout:)
def initialize(stdout:) @stdout = stdout end
def puts(...)
def puts(...) stdout.puts(...) end
def puts_green(string)
def puts_green(string) if can_display_colors? puts "\e[32m#{string}\e[m" else puts string end end
def puts_red(string)
def puts_red(string) if can_display_colors? puts "\e[31m#{string}\e[m" else puts string end end