class Chef::Knife::Diff

def run

def run
  if config[:name_only]
    output_mode = :name_only
  end
  if config[:name_status]
    output_mode = :name_status
  end
  patterns = pattern_args_from(name_args.length > 0 ? name_args : [ "" ])
  # Get the matches (recursively)

  error = false
  begin
    patterns.each do |pattern|
      found_error = Chef::ChefFS::CommandLine.diff_print(pattern, chef_fs, local_fs, config[:recurse] ? nil : 1, output_mode, proc { |entry| format_path(entry) }, config[:diff_filter], ui ) do |diff|
        stdout.print diff
      end
      error = true if found_error
    end
  rescue Chef::ChefFS::FileSystem::OperationFailedError => e
    ui.error "Failed on #{format_path(e.entry)} in #{e.operation}: #{e.message}"
    error = true
  end
  if error
    exit 1
  end
end