Sha256: 9f53820c183abaaa56c6f96c5fd79907013a6ae96342f810186b5441316fa767
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
#!/usr/bin/env ruby require "optparse" require "ramesh" USAGE = <<-EOS Usage: ramesh [-d save_dir] [-f filename] download the latest image ramesh [-d save_dir] [-f filename] 0..120 download the image specified minutes before ramesh [-d save_dir] [-f filename] 0..120 0..120 download images within a specified range ramesh -h, --help show this usage EOS save_dir = Dir.pwd filename = nil large_image = false parser = OptionParser.new(USAGE) do |opt| opt.on("-d", "--dir=VAL", "Save directory (default: current directory)") { |val| save_dir = val } opt.on("-f", "--filename=VAL", "Save file name (default: timestamp index of downloaded image)") { |val| filename = val } opt.on("-l", "--large", "Download large image") { |large| large_image = large } end argv = parser.parse(ARGV) client = Ramesh::Client.new case argv.length when 0 if large_image puts client.download_large_image(0, save_dir, filename) else puts client.download_image(0, save_dir, filename) end when 1 if large_image puts client.download_large_image(argv[0].to_i, save_dir, filename) else puts client.download_image(argv[0].to_i, save_dir, filename) end when 2 puts client.download_sequential_images(argv[0].to_i, argv[1].to_i, save_dir).join(", ") else $stderr.puts USAGE exit 1 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ramesh-1.4.0 | bin/ramesh |