Sha256: 08dfc1ef9a3856f4f6a07a5d8e5f6d8b7b838ece96a66b94fe848cf3ae4a6e02
Contents?: true
Size: 707 Bytes
Versions: 2
Compression:
Stored size: 707 Bytes
Contents
module Downer class Options < Hash attr_reader :opts, :orig_args def initialize(args) @opts = args.clone self[:is_website] = false self[:images_only] = false @opts = OptionParser.new do |o| o.banner = "Usage: downer -flags URL_SOURCE DESTINATION_DIR" o.on('-i', '--image', 'When combined with w will download JPG,GIF,PNG formats') do self[:images_only] = true end end begin @opts.parse!(args) self[:file_manifest] = args.shift self[:target_directory] = args.shift rescue OptionParser::InvalidOption => e self[:invalid_argument] = e.message end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
downer-0.3.2 | lib/downer/options.rb |
downer-0.3.1 | lib/downer/options.rb |