Sha256: ef90a7a1341e378ac021fe381f538eb3b948ee24a3cf3bbc942b946c5661e510
Contents?: true
Size: 993 Bytes
Versions: 2
Compression:
Stored size: 993 Bytes
Contents
#!/usr/bin/env ruby require 'bundler/setup' require 'weather-report' require 'slop' opts = Slop.parse(help: true) do banner 'Usage: weather-report CITY [options]' separator "" separator "Common options:" on :l, :list, 'Show city list' do WeatherReport.cities.each do |city| puts city end exit end on :v, :version, "Show version" do puts "weather-report v#{WeatherReport::VERSION}" exit end end exit if opts.help? if ARGV.empty? puts opts.help exit end city = ARGV weather = WeatherReport::Weather.new(WeatherReport::Weather.request_cityid(*city)) [weather.today, weather.tomorrow, weather.day_after_tomorrow].each do |day| begin print "#{day.date.year}年#{day.date.month}月#{day.date.day}日の天気 #{day.telop}" print " 最低気温#{day.temperature_min}度" if day.temperature_min print " 最高気温#{day.temperature_max}度" if day.temperature_max puts rescue NoMethodError next end end puts weather.link
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
weather-report-0.4.2 | bin/weather-report |
weather-report-0.4.1 | bin/weather-report |