mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/irb] Update regarding NO_COLOR value
https://no-color.org has been updated (jcs/no_color#83): > Command-line software which adds ANSI color to its output by default should check for a `NO_COLOR` environment variable that, when present and **not an empty string** (regardless of its value), prevents the addition of ANSI color. https://github.com/ruby/irb/commit/46e0f7e370 Co-authored-by: Stan Lo <stan001212@gmail.com>
This commit is contained in:
parent
13e968c1cd
commit
56c97a6621
2 changed files with 5 additions and 1 deletions
|
@ -44,7 +44,7 @@ module IRB # :nodoc:
|
|||
@CONF[:IRB_RC] = nil
|
||||
|
||||
@CONF[:USE_SINGLELINE] = false unless defined?(ReadlineInputMethod)
|
||||
@CONF[:USE_COLORIZE] = !ENV['NO_COLOR']
|
||||
@CONF[:USE_COLORIZE] = (nc = ENV['NO_COLOR']).nil? || nc.empty?
|
||||
@CONF[:USE_AUTOCOMPLETE] = true
|
||||
@CONF[:INSPECT_MODE] = true
|
||||
@CONF[:USE_TRACER] = false
|
||||
|
|
|
@ -80,6 +80,10 @@ module TestIRB
|
|||
IRB.setup(__FILE__)
|
||||
refute IRB.conf[:USE_COLORIZE]
|
||||
|
||||
ENV['NO_COLOR'] = ''
|
||||
IRB.setup(__FILE__)
|
||||
assert IRB.conf[:USE_COLORIZE]
|
||||
|
||||
ENV['NO_COLOR'] = nil
|
||||
IRB.setup(__FILE__)
|
||||
assert IRB.conf[:USE_COLORIZE]
|
||||
|
|
Loading…
Add table
Reference in a new issue