Sha256: b086289ad8bd2ff61709eaa327f1bd85f0334e9d43afa70d7f39d9e6ae45268e

Contents?: true

Size: 848 Bytes

Versions: 2

Compression:

Stored size: 848 Bytes

Contents

#!/usr/bin/env ruby

require "optparse"
require "ramesh"

USAGE = <<-EOS
Usage:
    ramesh [-d save_dir]              download the latest image
    ramesh [-d save_dir] 0-120        download the image specified minutes before
    ramesh [-d save_dir] 0-120 0-120  download images within a specified range
    ramesh -h, --help                 show this usage
EOS

save_dir = Dir.pwd

parser = OptionParser.new(USAGE) do |opt|
  opt.on("-d", "--dir=VAL", "Save directory (default: current directory)") { |val| save_dir = val }
end

argv = parser.parse(ARGV)

client = Ramesh::Client.new(Ramesh::Logger.new(STDOUT))

case argv.length
when 0
  client.download_image(save_dir)
when 1
  client.download_image(save_dir, argv[0].to_i)
when 2
  client.download_sequential_images(save_dir, argv[0].to_i, argv[1].to_i)
else
  $stderr.puts USAGE
  exit 1
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ramesh-1.2.0 bin/ramesh
ramesh-1.1.0 bin/ramesh