diff --git a/bin/gman b/bin/gman index a2412396..add4bb0b 100755 --- a/bin/gman +++ b/bin/gman @@ -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 ".red + puts "USAGE: gman [--no-color]".red exit 1 end diff --git a/test/test_gman_bin.rb b/test/test_gman_bin.rb index 06675c39..e2e3032f 100644 --- a/test/test_gman_bin.rb +++ b/test/test_gman_bin.rb @@ -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