Sha256: 2ad8e974ae03654801ba502a2303b6fd170e3adeb62a7abef32386c43afa954c

Contents?: true

Size: 851 Bytes

Versions: 3

Compression:

Stored size: 851 Bytes

Contents

#!/usr/bin/env ruby

require 'trollop'

root = File.expand_path('../../', __FILE__)
lib = "#{root}/lib"
$:.unshift lib unless $:.include?(lib)

require 'dl'

opts = Trollop::options do
  version "dl #{Dl::VERSION} (c) 2011 Mark Szymanski"
  banner <<-EOS
dl is an extremely simplified version of wget/curl, written in Ruby.

Usage:

    dl [options] <url>

Where [options] are:
EOS
  opt :raw, "Don't save downloaded data to disk, simply print it to standard output."
  opt :quiet, "Don't output any download status info."
  opt :file, "Output to a specific filename, will not work in conjunction with the --raw option.", :type => :string
end

if opts[:raw] == true and opts[:file] != nil
  puts "Error: --raw and --file cannot be used in conjunction"
  exit 1
end

Dl::be_quiet = opts[:quiet]
Dl::file = opts[:file]

Dl::download ARGV[0], opts[:raw]

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dl-1.2.2 bin/dl
dl-1.2.1 bin/dl
dl-1.2.0 bin/dl