Sha256: 1eb089d84cc4fdb2c458c4bb0c1813796795e7bd2765d54765a8740abcccf7ac
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
#!/usr/bin/env ruby require 'optparse' require_relative '../loader' class CollageParser def self.parse(params) args = {} OptionParser.new do |opts| opts.banner = 'Usage: collage -w word1,word2..wordN -o outfile.png' opts.on('-w', '--words ', Array, 'Flickr Search Words') do |w| args[:words] = w end opts.on('-o', '--out-file ', String, 'Output File') do |f| args[:outfile] = f end opts.on_tail('-h', '--help', 'Show this message') do puts opts exit end end.parse! params args end end args = if ARGV.empty? %w(--help) else ARGV end options = CollageParser.parse args collage = Collage.new options[:words] collage.download_images.build options[:outfile] if RUBY_PLATFORM.downcase =~ /darwin/ fork { system "open #{options[:outfile]}" } elsif RUBY_PLATFORM.downcase =~ /linux/ fork { system "eog #{options[:outfile]}" } elsif RUBY_PLATFORM.downcase =~ /mswin/ puts 'Dude Seriously, Windows?' end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
flickr_collager-0.0.1 | bin/collage |