Skip to content

Commit

Permalink
Merge pull request #82 from benbalter/color
Browse files Browse the repository at this point in the history
Allow disabling colorized output via CLI
  • Loading branch information
benbalter committed Jan 28, 2015
2 parents 93734bd + 4f068d2 commit 804cae6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bin/gman
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ class IsoCountryCodes
end

domain = ARGV[0]
String.disable_colorization = true if ARGV[1] == "--no-color"

if domain.nil?
puts "USAGE: gman <domain or email address>".red
puts "USAGE: gman <domain or email address> [--no-color]".red
exit 1
end

Expand Down
9 changes: 9 additions & 0 deletions test/test_gman_bin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,13 @@ def setup
assert_match /DC/, @output
assert_equal 0, @status.exitstatus
end

should "allow you to disable colorization" do
output, status = test_bin("whitehouse.gov", "--no-color")
refute_match /\[0;32;49m/, output
end

should "color by default" do
assert_match /\[0;32;49m/, @output
end
end

0 comments on commit 804cae6

Please sign in to comment.