class Rufo::Command

def format_args(args)

def format_args(args)
  files = []
  args.each do |arg|
    if Dir.exist?(arg)
      files.concat Dir[File.join(arg, "**", "*.rb")].select(&File.method(:file?))
    elsif File.exist?(arg)
      files << arg
    else
      STDERR.puts "Error: file or directory not found: #{arg}"
    end
  end
  return CODE_ERROR if files.empty?
  changed = false
  syntax_error = false
  files.each do |file|
    result = format_file(file)
    changed |= result == CODE_CHANGE
    syntax_error |= result == CODE_ERROR
  end
  STDERR.puts squiggly_heredoc_warning unless @squiggly_warning_files.empty?
  case
  when syntax_error then CODE_ERROR
  when changed      then CODE_CHANGE
  else                   CODE_OK
  end
end