lib/danger/commands/runner.rb in danger-5.6.6 vs lib/danger/commands/runner.rb in danger-5.6.7

- old
+ new

@@ -40,10 +40,11 @@ @new_comment = argv.flag?("new-comment") @remove_previous_comments = argv.flag?("remove-previous-comments") @danger_id = argv.option("danger_id", "danger") @cork = Cork::Board.new(silent: argv.option("silent", false), verbose: argv.option("verbose", false)) + adjust_colored2_output(argv) super end def validate! super @@ -72,8 +73,17 @@ danger_id: @danger_id, new_comment: @new_comment, fail_on_errors: @fail_on_errors, remove_previous_comments: @remove_previous_comments ) + end + + private + + def adjust_colored2_output(argv) + # disable/enable colored2 output + # consider it execution wide to avoid need to wrap #run and maintain state + # ARGV#options is non-destructive way to check flags + Colored2.public_send(argv.options.fetch("ansi", true) ? "enable!" : "disable!") end end end