lib/masticate/myoptparse.rb in masticate-0.2.1 vs lib/masticate/myoptparse.rb in masticate-0.2.2

- old
+ new

@@ -35,10 +35,14 @@ opts.on("--field FIELD", String, "Specify field to convert") do |f| @options[:field] = f end + opts.on("--value VALUE", String, "(*exclude* only) Value to compare field to for exclusion") do |s| + @options[:value] = s + end + opts.on("--snip DIRECTIVE", String, "Specify header fields to snip: first N, or by name") do |f| @options[:snip] = f.to_i end opts.on("--from REGEXP", String, "Regular expression for gsub conversion") do |s| @@ -83,11 +87,12 @@ klasses = { 'gsub' => Masticate::Gsubber, 'datify' => Masticate::Datify, 'maxrows' => Masticate::MaxRows, 'relabel' => Masticate::Relabel, - 'pluck' => Masticate::Plucker + 'pluck' => Masticate::Plucker, + 'exclude' => Masticate::Exclude } klass = klasses[command] klass.new(options) end @@ -141,9 +146,13 @@ results = Masticate.relabel(filename, options) # logmessage(command, options, results) when 'cook' results = Masticate.cook(filename, options) + logmessage(command, options, results) + + when 'exclude' + results = Masticate.exclude(filename, options) logmessage(command, options, results) else raise "unknown command #{command}" end