Skip to content

Commit

Permalink
Add option to disable the coloring in the output
Browse files Browse the repository at this point in the history
  • Loading branch information
aerostitch committed Mar 23, 2018
1 parent 84c41b9 commit c09e439
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions bin/yaml-lint
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ OptionParser.new do |opts|
options[:ignorenoyaml] = true
end

opts.on("-c", "--no-color", "Disables the colors in the output.") do |n|
options[:nocolor] = true
end

opts.on_tail("-h", "--help") do |q|
puts 'yaml-lint is a tool to check the syntax of your YAML files'
puts opts
Expand Down
4 changes: 2 additions & 2 deletions lib/yaml-lint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def error(message)
def emit(opts={})
color = opts[:color]
message = opts[:message]
print ESCAPES[color]
print ESCAPES[color] unless @config[:nocolor]
print message
print ESCAPES[:reset]
print ESCAPES[:reset] unless @config[:nocolor]
print "\n"
end
end
Expand Down

0 comments on commit c09e439

Please sign in to comment.