Sha256: 26acebed784abb8b1a30f618f80b9a252a8fa4432eafc28dfa8145cd78a5f995

Contents?: true

Size: 966 Bytes

Versions: 2

Compression:

Stored size: 966 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
    date = weather.date
    temperature_day = weather.temperature_day
    temperature_night = weather.temperature_night
    rain_probability = weather.rain_probability
    condition_day = weather.condition_day
    condition_night = weather.condition_night
    tips = weather.tips
    puts "#{city}(#{city_eng})在 #{date} 的天氣狀況:"
    puts "白天氣象:#{condition_day},氣溫 #{temperature_day} 度"
    puts "晚上氣象:#{condition_night},氣溫 #{temperature_night} 度"
    puts "降雨機率:#{rain_probability}"
    puts "溫馨叮嚀:"
    puts "#{tips}"
  end
end

WeatherCLI.start(ARGV)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
weatherscout-0.1.1 bin/weatherscout
weatherscout-0.1.0 bin/weatherscout