Skip to content

Commit

Permalink
Added quick check for .weather file in home dir.
Browse files Browse the repository at this point in the history
Got tired of typing zip.
  • Loading branch information
jnunemaker committed Apr 21, 2012
1 parent 7e0d53b commit ffaee62
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions bin/weather
@@ -1,17 +1,25 @@
#!/usr/bin/env ruby

require 'rubygems'
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
path = Pathname(ENV["HOME"]).join('.weather')

if path.exist? && ARGV.size == 0
param = path.read
else
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

param = ARGV[0]
end

weather = GoogleWeather.new(ARGV[0])
weather = GoogleWeather.new(param)
current = weather.current_conditions
puts
puts "#{weather.forecast_information.city}"
Expand Down

0 comments on commit ffaee62

Please sign in to comment.