Sha256: 2268e00f82aa421cf5b6a9782d9732789a08671c45228ffc98df3cecc09448af

Contents?: true

Size: 938 Bytes

Versions: 1

Compression:

Stored size: 938 Bytes

Contents

#!/usr/bin/env ruby

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))

require 'trollop'
require 'archive_lister'

@options = Trollop::options do
  version "arcl version #{ArchiveLister::VERSION}"

  opt :input_file, 'File from which to draw the urls', type: String
  opt :output_dir, 'Dir to output files (requires --input-file)', type: String
  opt :skip_existing, 'Skip existing files when in batch', type: TrueClass
  opt :verbose, 'Print failures at finish', type: TrueClass
end

mode = (@options[:input_file] && @options[:output_dir]) ? :batch : :single

case mode
  when :single
    begin
      ArchiveLister.list(ARGV[0]).each do |url|
        puts url
      end
    rescue ArchiveLister::HttpError => e
      puts e
    end
  when :batch
    ArchiveLister.batch(
        @options[:input_file],
        @options[:output_dir],
        @options.select { |k, _| [:skip_existing, :verbose].include?(k) }
    )
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
archive_lister-0.0.1 bin/arcl