def process_options(args)
status = 0
self.options = {}
parser = OptionParser.new do |opts|
opts.banner = "Usage: \#{$0} generate [file_name]\n\n Generates a configuration file template under name [file_name].\n"
opts.separator ""
opts.separator " Specific options:"
opts.on_tail("--help", "Show this message") do
$stderr.puts opts
self.options = nil
end
end
begin
unprocessed_args = parser.parse!(args)
if options
raise("Please specify the name of the configuration file") if unprocessed_args.empty?
options[:file_name] = unprocessed_args[0]
end
rescue Exception => e
$stderr.puts "Command line parsing failed: #{e}"
$stderr.puts parser.help
self.options = nil
status = 1
end
return status
end