bin/masticate in masticate-0.1.1 vs bin/masticate in masticate-0.1.3
- old
+ new
@@ -11,15 +11,19 @@
opts.on("--format FORMAT", "Specify format") do |v|
options[:format] = v
end
- opts.on("--delim DELIMITER", "Specify field delimiter (character or TAB)") do |v|
+ opts.on("--delim DELIMITER", "Specify field delimiter (character or TAB; default is ',')") do |v|
options[:col_sep] = v
options[:col_sep] = "\t" if options[:col_sep] == "TAB"
end
+ opts.on("--quote QUOTE-CHAR", "Specify character used for quoting fields (optional; default is no quoting)") do |char|
+ options[:quote_char] = char
+ end
+
opts.on("--fields LIST", Array, "Specify fields to select") do |list|
options[:fields] = list
end
opts.on("--field FIELD", "Specify field to convert") do |f|
@@ -39,19 +43,26 @@
end
opts.on("--inlined", "(for *mend* only) Source file has headers inlined on each line") do |v|
options[:inlined] = v
end
+
+ opts.on("--dejunk", "(for *mend* only) Expunge junk lines from source") do |v|
+ options[:dejunk] = v
+ end
end.parse!
filename = ARGV.shift # use stdin if no filename provided
def logmessage(command, options, results)
$stderr.puts <<-EOT
* masticate #{command} (#{options.keys.join(', ')})
Lines in input: #{results[:input_count]}
Lines in output: #{results[:output_count]}
EOT
+ if results[:field_counts]
+ $stderr.puts " Field counts: #{results[:field_counts].inspect}"
+ end
end
case command
when 'sniff'
results = Masticate.sniff(filename)