lib/masticate/myoptparse.rb in masticate-0.3.2 vs lib/masticate/myoptparse.rb in masticate-0.4.0

- old
+ new

@@ -72,10 +72,14 @@ end opts.on("--recipe FILENAME", String, "(*cook* only) Recipe file") do |f| @options[:recipe] = f end + + opts.on("--rule {downcase,upcase}", String, "(*transform* only) Transformation rule") do |f| + @options[:rule] = f + end end end def parse(argv = ARGV) @command = argv.shift @@ -85,10 +89,11 @@ end def prepare(command, options) klasses = { 'gsub' => Masticate::Gsubber, + 'transform' => Masticate::Transform, 'datify' => Masticate::Datify, 'maxrows' => Masticate::MaxRows, 'relabel' => Masticate::Relabel, 'pluck' => Masticate::Plucker, 'exclude' => Masticate::Exclude, @@ -152,9 +157,13 @@ results = Masticate.cook(filename, options) logmessage(command, options, results) when 'exclude' results = Masticate.exclude(filename, options) + logmessage(command, options, results) + + when 'transform' + results = Masticate.transform(filename, options) logmessage(command, options, results) else raise "unknown command #{command}" end