def process_options(args)
status = 0
self.options = DEFAULT_OPTIONS.clone
parser = OptionParser.new do |opts|
opts.banner = "Usage: \#{$0} \#{self.class.name.sub(/^.*::(.*)Runner$/, '\\\\1').downcase} [options] [table_spec] [table_spec] ...\n\n \#{summary_description}\n\n table_spec can be either:\n * a specific table name (e. g. 'users') or\n * a pair of (specific) table names (e. g.: 'users,users_backup')\n (In this case the first table in the 'left' database is compared\n with the second table in the 'right' database.)\n * a regular expression (e. g. '/^user/') [case insensitive match]\n If no table_specs are provided via command line, the ones from the\n configuration file are used.\n"
opts.separator ""
opts.separator " Specific options:"
ScanReportPrinters.on_printer_selection(opts) do |printer_class, arg|
self.report_printer_class = printer_class
self.report_printer_arg = arg
end
ScanProgressPrinters.on_printer_selection(opts) do |printer|
self.selected_progress_printer = printer
end
opts.on("-c", "--config", "=CONFIG_FILE",
"Mandatory. Path to configuration file.") do |arg|
options[:config_file] = arg
end
add_specific_options(opts)
opts.on_tail("--help", "Show this message") do
$stderr.puts opts
self.options = nil
end
end
begin
unprocessed_args = parser.parse!(args)
if options
options[:table_specs] = unprocessed_args
raise("Please specify configuration file") unless options.include?(:config_file)
end
rescue Exception => e
$stderr.puts "Command line parsing failed: #{e}"
$stderr.puts parser.help
self.options = nil
status = 1
end
return status
end