Sha256: ea04e2cf9f9f5589f2e31ffa5f7490c507d95f25abd816f0c8ed481656f267c8
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
#!/usr/bin/env ruby # -*- coding: utf-8 -*- require 'rubygems' $:.unshift File.expand_path '../lib', File.dirname(__FILE__) 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
weather-report-0.4.0 | bin/weather-report |