lib/meteo/meteo_cli.rb in meteo-1.0.0 vs lib/meteo/meteo_cli.rb in meteo-1.0.1
- old
+ new
@@ -11,19 +11,24 @@
`meteo` will print weather quote for requested city.
You can optionally specify a second parameter, which will print
out a from message as well.
- > $ meteo quote "plainsboro, nj"
+ > $ meteo Plainsboro, NJ
+ > $ meteo Moscow, RU --units=metric
LONGDESC
- option :units
+ option :units, :aliases => "-u"
def quote(location)
units = options[:units] ? options[:units] : "imperial"
service = Meteo.new
response = JSON.parse(service.quote(location, units))
- puts report(response, units).join(' ')
+ if response["message"]
+ puts response["message"]
+ else
+ puts report(response, units).join(' ')
+ end
end
end