celsius option

This commit is contained in:
Dane Williams 2020-04-29 11:33:51 -07:00
parent 0b5735373b
commit 60675a1710
7 changed files with 15 additions and 26 deletions

View file

@ -1,11 +1,8 @@
#!/usr/bin/env bash
#author: Dane Williams
#script for gathering current location and weather at location
#script is then called in the dracula.tmux program
# test if rate limit hit
# only testing last request because of redundancy
fahrenheit=$1
load_request_params()
{
@ -33,7 +30,11 @@ weather_information()
}
get_temp()
{
weather_information | grep 'deg;F' | cut -d '&' -f 1
if $fahrenheit; then
echo $(weather_information | grep 'deg;F' | cut -d '&' -f 1)
else
echo $(( ($(weather_information | grep 'deg;F' | cut -d '&' -f 1) - 32) * 5 / 9 ))
fi
}
forecast_unicode()
{
@ -57,7 +58,7 @@ forecast_unicode()
display_weather()
{
if [ $country = 'US' ]; then
echo "$(forecast_unicode)$(get_temp)°F"
echo "$(forecast_unicode)$(get_temp)°"
else
echo ''
fi