Sha256: 6df2ec02455869630e267a6d9e7a59cec9e8289ccf0a33cb2c216f1df271008f

Contents?: true

Size: 859 Bytes

Versions: 1

Compression:

Stored size: 859 Bytes

Contents

#!/usr/bin/env ruby

require "fixbraces"
require "trollop"
require "pathname"

opts = Trollop::options do
  version "v#{Fixbraces::VERSION}"

  banner <<BANN
Puts the opening brace on the same line as the opening clause for Objective-C (.h and .m) files.

Usage:
  fixbraces [options] files ...

where [options] are:
BANN

end

source_files = []

ARGV.each do |f|
  f = File.expand_path f
  extension = File.extname f

  if File.directory? f
    source_files.push Dir.glob File.join(f, "**/*.{h,m}")
  elsif File.file? f and (extension == ".h" or extension == ".m")
    source_files.push f
  end

end

source_files.flatten.each do |f|
  changed_file = Fixbraces.process_file f

  if changed_file
    path_name = Pathname.new changed_file
    relative_path_name = path_name.relative_path_from Pathname.pwd
    puts "Corrected: #{relative_path_name}"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fixbraces-1.1.0 bin/fixbraces