Allowing calling ip weather with imperial or metric

This commit is contained in:
Alex Epstein 2017-06-29 02:27:59 -04:00
parent 23b6f98c7d
commit 3d2540b42a
1 changed files with 6 additions and 2 deletions

View File

@ -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