bin/mergit in mergit-0.1.0 vs bin/mergit in mergit-1.0.0

- old
+ new

@@ -1,9 +1,9 @@ #!/usr/bin/env ruby # -*- coding: utf-8 -*- -$: << File.expand_path('../../lib/', __FILE__) if File.directory?(File.expand_path('../../lib/', __FILE__)) +$: << File.expand_path('../../lib/', __FILE__) if File.directory?(File.expand_path('../../lib/', __FILE__)) # MERGIT: skip require 'mergit' require 'optparse' class MergitProgram attr_accessor :output @@ -38,9 +38,16 @@ if d.directory? mergit.search_path.unshift d.realpath.to_s else err "'#{d}' is not a directory." end + end + + opts.on('-r', '--replace MATCH=REPLACEMENT', String, + "Replaces all occurrences of MATCH with REPLACEMENT. If MATCH is between / characters, then it'll be used as a case-sensitive regexp. Can be specified multiple times.") do |m| + match, replace = m.split(/=/) + match = Regexp.new(match.slice(1..-2)) if match.start_with?('/') && match.end_with?('/') + mergit.replacements[match] = replace end opts.on('-d', '--debug', "Turn on debugging.") do @debug = true end