def opts
      @opts ||= OptionParser.new do |opts|
        opts.program_name = File.basename($PROGRAM_NAME)
        opts.banner = "Usage: #{opts.program_name}"

        opts.separator ''
        opts.separator 'Actions:'

        names = @actions.map(&:name)
        padding = names.map(&:size).max
        @actions.each do |action|
          opts.separator "  #{action.name.ljust(padding)}  #{action.description}\n"
        end

        opts.separator ''
        opts.separator 'Tasks:'

        @processor_class.tasks.each do |task_name|
          opts.separator "  #{task_name}"
        end

        opts.separator ''
        opts.separator 'Specific options:'
        opts.on('-a', '--action ACTION', names, 'Select an action to run (you may give this switch multiple times)', "  (#{names.join(', ')})") do |v|
          options.actions << v
        end
        opts.on('-t', '--task TASK', @processor_class.tasks, 'Select a scraping task to run (you may give this switch multiple times)', "  (#{@processor_class.tasks.join(', ')})") do |v|
          options.tasks << v
        end
        opts.on('-o', '--output_dir PATH', 'The directory or Redis address (e.g. redis://localhost:6379/0) in which to dump JSON documents') do |v|
          options.output_dir = v
        end
        opts.on('--pipelined', 'Dump JSON documents all at once') do |v|
          options.pipelined = v
        end
        opts.on('-c', '--cache_dir PATH', 'The directory or Memcached address (e.g. memcached://localhost:11211) in which to cache HTTP requests') do |v|
          options.cache_dir = v
        end
        opts.on('--no-cache', 'Disable HTTP request caching') do |v|
          options.cache_dir = nil
        end
        opts.on('-e', '--expires_in SECONDS', "The cache's expiration time in seconds") do |v|
          options.expires_in = v
        end
        opts.on('--value_max_bytes BYTES', "The maximum Memcached item size") do |v|
          options.value_max_bytes = v
        end
        opts.on('--memcached_username USERNAME', "The Memcached username") do |v|
          options.memcached_username = v
        end
        opts.on('--memcached_password USERNAME', "The Memcached password") do |v|
          options.memcached_password = v
        end
        opts.on('-d', '--database_url', 'The database URL (e.g. mongodb://USER:PASSWORD@localhost:27017/pupa or postgres://USER:PASSWORD@localhost:5432/pupa') do |v|
          options.database_url = v
        end
        opts.on('--[no-]validate', 'Validate JSON documents') do |v|
          options.validate = v
        end
        opts.on('-v', '--verbose', 'Show all messages') do
          options.level = 'DEBUG'
        end
        opts.on('-q', '--quiet', 'Show only warning and error messages') do
          options.level = 'WARN'
        end
        opts.on('-s', '--silent', 'Show no messages') do
          options.level = 'UNKNOWN'
        end
        opts.on('-n', '--dry-run', 'Show the plan without running any actions') do
          options.dry_run = true
        end

        opts.separator ''
        opts.separator 'Common options:'
        opts.on_tail('-h', '--help', 'Show this message') do
          puts opts
          exit
        end
        opts.on_tail('-v', '--version', 'Show version') do
          puts Pupa::VERSION
          exit
        end
      end
    end
def opts
      @opts ||= OptionParser.new do |opts|
        opts.program_name = File.basename($PROGRAM_NAME)
        opts.banner = "Usage: #{opts.program_name}"

        opts.separator ''
        opts.separator 'Actions:'

        names = @actions.map(&:name)
        padding = names.map(&:size).max
        @actions.each do |action|
          opts.separator "  #{action.name.ljust(padding)}  #{action.description}\n"
        end

        opts.separator ''
        opts.separator 'Tasks:'

        @processor_class.tasks.each do |task_name|
          opts.separator "  #{task_name}"
        end

        opts.separator ''
        opts.separator 'Specific options:'
        opts.on('-a', '--action ACTION', names, 'Select an action to run (you may give this switch multiple times)', "  (#{names.join(', ')})") do |v|
          options.actions << v
        end
        opts.on('-t', '--task TASK', @processor_class.tasks, 'Select a scraping task to run (you may give this switch multiple times)', "  (#{@processor_class.tasks.join(', ')})") do |v|
          options.tasks << v
        end
        opts.on('-o', '--output_dir PATH', 'The directory or Redis address (e.g. redis://localhost:6379/0) in which to dump JSON documents') do |v|
          options.output_dir = v
        end
        opts.on('--pipelined', 'Dump JSON documents all at once') do |v|
          options.pipelined = v
        end
        opts.on('-c', '--cache_dir PATH', 'The directory or Memcached address (e.g. memcached://localhost:11211) in which to cache HTTP requests') do |v|
          options.cache_dir = v
        end
        opts.on('--no-cache', 'Disable HTTP request caching') do |v|
          options.cache_dir = nil
        end
        opts.on('-e', '--expires_in SECONDS', "The cache's expiration time in seconds") do |v|
          options.expires_in = v
        end
        opts.on('--value_max_bytes BYTES', "The maximum Memcached item size") do |v|
          options.value_max_bytes = v
        end
        opts.on('--memcached_username USERNAME', "The Memcached username") do |v|
          options.memcached_username = v
        end
        opts.on('--memcached_password USERNAME', "The Memcached password") do |v|
          options.memcached_password = v
        end
        opts.on('-d', '--database_url', 'The database URL (e.g. mongodb://USER:PASSWORD@localhost:27017/pupa or postgres://USER:PASSWORD@localhost:5432/pupa') do |v|
          options.database_url = v
        end
        opts.on('--[no-]validate', 'Validate JSON documents') do |v|
          options.validate = v
        end
        opts.on('-v', '--verbose', 'Show all messages') do
          options.level = 'DEBUG'
        end
        opts.on('-q', '--quiet', 'Show only warning and error messages') do
          options.level = 'WARN'
        end
        opts.on('-s', '--silent', 'Show no messages') do
          options.level = 'UNKNOWN'
        end
        opts.on('-n', '--dry-run', 'Show the plan without running any actions') do
          options.dry_run = true
        end

        opts.separator ''
        opts.separator 'Common options:'
        opts.on_tail('-h', '--help', 'Show this message') do
          puts opts
          exit
        end
        opts.on_tail('-v', '--version', 'Show version') do
          puts Pupa::VERSION
          exit
        end
      end
    end
Returns the command-line option parser.

 @return [OptionParser] the command-line option parser