diffy icon indicating copy to clipboard operation
diffy copied to clipboard

Command line option override not working as advertised

Open JasonBarnabe opened this issue 11 years ago • 2 comments

Diffy 3.0.6 Ruby 2.1.3 diffutils 3.3

https://github.com/samg/diffy#overriding-the-command-line-options-passed-to-diff claims

>> puts Diffy::Diff.new(" foo\nbar\n", "foo\nbar\n", :diff => "-w")
  foo
 bar

But when I try:

2.1.3p242 :001 > puts Diffy::Diff.new(" foo\nbar\n", "foo\nbar\n", :diff => "-w")

 => nil 

or even with a blank override:

2.1.3p242 :002 > puts Diffy::Diff.new(" foo\nbar\n", "foo\nbar\n", :diff => "")

 => nil 

but works with no override:

2.1.3p242 :003 > puts Diffy::Diff.new(" foo\nbar\n", "foo\nbar\n")
- foo
+foo
 bar
 => nil 

JasonBarnabe avatar Dec 24 '14 04:12 JasonBarnabe

Looks like you're right.

I think you can accomplish what you want with syntax like this:

Diffy::Diff.new("foo\nbaz", "foo \nbar\n", :diff => ["-U 10000", "-w"])

I'll look into updating the readme and or fixing this weird behavior.

samg avatar Dec 28 '14 07:12 samg

Hi, Just to confirm the behaviour and the fix/workaround: in my case, hash_diff = Diffy::Diff.new(source, destination, :diff => ["-U 10000", "-E", "-b"]).to_s(:html) works just as expected

simongareste avatar Aug 26 '15 09:08 simongareste