Module: DiffMatcher::CLI

Defined in:
lib/diff_matcher/cli.rb

Class Method Summary collapse

Class Method Details

.diff(expected, actual, opts = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/diff_matcher/cli.rb', line 5

def self.diff(expected, actual, opts={})
  # TODO maybe parse opts from command line instead of ENV vars...
  diff_opts = {
    color_enabled: true,
    ignore_additional: ENV['IGNORE_ADDITIONAL'],
    quiet: !ENV['VERBOSE']
  }

  if (diff_string = DiffMatcher.difference(expected, actual, diff_opts))
    puts diff_string
    exit 1
  end
end