Skip to content
Browse files

Added weather bin that does a quick show of the weather from the comm…

…and line.
  • Loading branch information...
1 parent 1affe3d commit 5a3352c4fbfe8120f6c8ebe9e3b3e46a43ef6f03 @jnunemaker committed Mar 27, 2009
Showing with 18 additions and 0 deletions.
  1. +16 −0 bin/weather
  2. +2 −0 examples/forecast.rb
View
16 bin/weather
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../lib/google_weather'
+
+if ARGV.size == 0
+ puts 'Weather [Powered by Google]'
+ puts 'USAGE: weather [zip code or city]'
+ puts 'EXAMPLES:'
+ puts ' weather 46544'
+ puts ' weather "mishawaka, in"'
+ exit
+end
+
+weather = GoogleWeather.new(ARGV[0])
+current = weather.current_conditions
+puts "#{current.temp_f}° #{current.condition} - #{current.wind_condition} - #{current.humidity}"
View
2 examples/forecast.rb
@@ -7,5 +7,7 @@
puts forecast.day_of_week, forecast.low, forecast.high, forecast.condition
pp weather.forecast_information
+puts
pp weather.current_conditions
+puts
pp weather.forecast_conditions

0 comments on commit 5a3352c

Please sign in to comment.
Something went wrong with that request. Please try again.