From 3d2540b42a08aba93195345194a3f05e2d767192 Mon Sep 17 00:00:00 2001 From: Alex Epstein Date: Thu, 29 Jun 2017 02:27:59 -0400 Subject: [PATCH] Allowing calling ip weather with imperial or metric --- weather/weather | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/weather/weather b/weather/weather index 8169e73..51affa0 100755 --- a/weather/weather +++ b/weather/weather @@ -11,10 +11,10 @@ getIPWeather() city=$(curl -s ipinfo.io/city) > /dev/null region=$(curl -s ipinfo.io/region) > /dev/null region=$(echo "$region" | tr -dc '[:upper:]') - curl $locale.wttr.in/$city,$region + curl $locale.wttr.in/$city,$region$1 else ## otherwise we are going to use longitude and latitude location=$(curl -s ipinfo.io/loc) > /dev/null - curl $locale.wttr.in/$location + curl $locale.wttr.in/$location$1 fi } @@ -108,6 +108,10 @@ if [[ $# == "0" ]]; then getIPWeather elif [[ $1 == "update" ]]; then update +elif [[ $1 == "m" ]]; then + getIPWeather "?m" +elif [[ $1 == "i" ]]; then + getIPWeather "?u" else getLocationWeather $1 $2 $3 $4 fi