Fix positional argument color [ci skip]
This commit is contained in:
parent
0ba65c689e
commit
e809bd31fd
@ -6,7 +6,7 @@ class Colorize
|
|||||||
# Colorize.new(color: color, colors_file: colors_file)
|
# Colorize.new(color: color, colors_file: colors_file)
|
||||||
def initialize(color = nil, opts = ((_, color = color, nil)[0] if Hash === color))
|
def initialize(color = nil, opts = ((_, color = color, nil)[0] if Hash === color))
|
||||||
@colors = @reset = nil
|
@colors = @reset = nil
|
||||||
@color = (opts[:color] if opts)
|
@color = opts && opts[:color] || color
|
||||||
if color or (color == nil && STDOUT.tty? && (ENV["NO_COLOR"] || "").empty?)
|
if color or (color == nil && STDOUT.tty? && (ENV["NO_COLOR"] || "").empty?)
|
||||||
if (%w[smso so].any? {|attr| /\A\e\[.*m\z/ =~ IO.popen("tput #{attr}", "r", :err => IO::NULL, &:read)} rescue nil)
|
if (%w[smso so].any? {|attr| /\A\e\[.*m\z/ =~ IO.popen("tput #{attr}", "r", :err => IO::NULL, &:read)} rescue nil)
|
||||||
@beg = "\e["
|
@beg = "\e["
|
||||||
|
Loading…
x
Reference in New Issue
Block a user