def show_diff_and_write(content, outfile, options = {
      :no_interaction => false,
      :json_pretty_format => false,
      :no_commit => false
    })
      if File.exist?( outfile )
        ref = File.read( outfile )
        if options[:json_pretty_format]
          ref = JSON.pretty_generate(JSON.parse( IO.read( outfile ) ))
        end
        if ref == content
          warn "Nothing to update"
          return 0
        end
        warn "the file '#{outfile}' already exists and will be overwritten."
        warn "Expected difference: \n------"
        Diffy::Diff.default_format = :color
        puts Diffy::Diff.new(ref, content, :context => 1)
      else
        watch = (options[:no_interaction]) ? 'no' : ask( cyan("  ==> Do you want to see the generated file before commiting the writing (y|N)"), 'No')
        puts content if watch =~ /y.*/i
      end
      proceed = (options[:no_interaction]) ? 'yes' : ask( cyan("  ==> proceed with the writing (Y|n)"), 'Yes')
      return 0 if proceed =~ /n.*/i
      info("=> writing #{outfile}")
      File.open(outfile.to_s, "w+") do |f|
        f.write content
      end
      if FalkorLib::Git.init?(File.dirname(outfile)) && !options[:no_commit]
        do_commit = (options[:no_interaction]) ? 'yes' : ask( cyan("  ==> commit the changes (Y|n)"), 'Yes')
        FalkorLib::Git.add(outfile, "update content of '#{File.basename(outfile)}'") if do_commit =~ /y.*/i
      end
      1
    end
def show_diff_and_write(content, outfile, options = {
      :no_interaction => false,
      :json_pretty_format => false,
      :no_commit => false
    })
      if File.exist?( outfile )
        ref = File.read( outfile )
        if options[:json_pretty_format]
          ref = JSON.pretty_generate(JSON.parse( IO.read( outfile ) ))
        end
        if ref == content
          warn "Nothing to update"
          return 0
        end
        warn "the file '#{outfile}' already exists and will be overwritten."
        warn "Expected difference: \n------"
        Diffy::Diff.default_format = :color
        puts Diffy::Diff.new(ref, content, :context => 1)
      else
        watch = (options[:no_interaction]) ? 'no' : ask( cyan("  ==> Do you want to see the generated file before commiting the writing (y|N)"), 'No')
        puts content if watch =~ /y.*/i
      end
      proceed = (options[:no_interaction]) ? 'yes' : ask( cyan("  ==> proceed with the writing (Y|n)"), 'Yes')
      return 0 if proceed =~ /n.*/i
      info("=> writing #{outfile}")
      File.open(outfile.to_s, "w+") do |f|
        f.write content
      end
      if FalkorLib::Git.init?(File.dirname(outfile)) && !options[:no_commit]
        do_commit = (options[:no_interaction]) ? 'yes' : ask( cyan("  ==> commit the changes (Y|n)"), 'Yes')
        FalkorLib::Git.add(outfile, "update content of '#{File.basename(outfile)}'") if do_commit =~ /y.*/i
      end
      1
    end
Show the difference between a `content` string and an destination file (using Diff algorithm).
 Obviosuly, if the outfile does not exists, no difference is proposed.
 Supported options:
   :no_interaction [boolean]:     do not interact
   :json_pretty_format [boolean]: write a json content, in pretty format
   :no_commit [boolean]:          do not (offer to) commit the changes
 return 0 if nothing happened, 1 if a write has been done