lib/assimilate/command.rb in assimilate-0.3 vs lib/assimilate/command.rb in assimilate-0.3.1

- old
+ new

@@ -18,11 +18,11 @@ opts.on("--commit", "Commit changes to database") do @options[:commit] = true end - opts.on("--key FIELDNAME", String, "(*extend* only) Hash key to store extended attributes under") do |f| + opts.on("--key FIELDNAME", String, "(*extend* only; optional) Hash key to store extended attributes under") do |f| @options[:key] = f end opts.on("--datestamp DATESTRING", String, "(*load* only) Datestamp to record for file batch operation") do |s| @options[:datestamp] = s @@ -60,11 +60,11 @@ results = Assimilate.load(filename, options) logmessage(command, options, results) when 'extend' - raise OptionParser::MissingArgument, "missing keyfield" unless options[:key] + # keyfield is an *optional* parameter results = Assimilate.extend_data(filename, options) logmessage(command, options, results) @@ -108,10 +108,10 @@ Updates: #{results[:updates_count]} EOT if results[:updated_fields].any? results[:updated_fields].each do |k,v| $stderr.puts <<-EOT - #{options[:key]}.#{k}: #{v} + #{options[:key] && options[:key] + '.'}#{k}: #{v} EOT end end else $stderr.puts results.inspect