Sha256: a12104e6aa8db6b2cf9e99a3a301dbe49f2a60452ecb61135c21f6c27b72f4d1

Contents?: true

Size: 782 Bytes

Versions: 1

Compression:

Stored size: 782 Bytes

Contents

#!/usr/bin/env ruby
require 'thor'
require 'weatherscout' # for production
# require './lib/weatherdesc/daily_weather.rb' # for cmd line testing purposes

class WeatherCLI < Thor
  desc 'today CITY', 'see the weather of the city today'
  def today(city)
    weather = DailyWeatherScraper::DailyWeather.new(city)
    city_eng = weather.city
    weathers = weather.weathers
    tips = weather.tips
    puts "#{city}(#{city_eng})的天氣預測:"
    weathers.each do |timestamp, weather|
      attributes = weather.values
      puts "#{timestamp}"
      puts "  -氣溫:#{attributes[0]} 度"
      puts "  -降雨機率:#{attributes[1]}"
      puts "  -天氣狀況:#{attributes[2]}"
    end
    puts "溫馨叮嚀:"
    puts "#{tips}"
  end
end

WeatherCLI.start(ARGV)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
weatherscout-0.2.0 bin/weatherscout