ansiweather

Weather in terminal, with ANSI colors and Unicode symbols
Log | Files | Refs | README | LICENSE

commit e4fe98daeaceb51466af982f008563f2ff24e55d
parent 3dcfca39bd3c77e8b34b9f5db2128efc57f86b2e
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date:   Thu, 24 Oct 2013 16:58:15 +0200

Converting pressure to inches of mercury when using imperial units (Thanks nemo)

Diffstat:
Mansiweather | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/ansiweather b/ansiweather @@ -86,7 +86,7 @@ weather=$($fetch_cmd "http://api.openweathermap.org/data/2.5/weather?q=$location city=$(echo $weather | jq -r '.name') temperature=$(printf '%.0f' $(echo $weather | jq '.main.temp')) humidity=$(echo $weather | jq '.main.humidity') -pressure=$(printf '%.0f' $(echo $weather | jq '.main.pressure')) +pressure=$(echo $weather | jq '.main.pressure') sky=$(echo $weather | jq -r '.weather[0].main') sunrise=$(echo $weather | jq '.sys.sunrise') sunset=$(echo $weather | jq '.sys.sunset') @@ -113,10 +113,14 @@ case $units in metric) scale="°C" speed_unit="m/s" + pressureUnit="hPa" + pressure=$(printf '%.0f' $pressure) ;; imperial) scale="°F" speed_unit="mph" + pressureUnit="inHg" + pressure=$(printf '%.2f' $(echo "$pressure*0.0295" | bc)) ;; esac @@ -148,4 +152,4 @@ fi ###[ Display current Weather ]################################################# -echo -e "$background$text Current weather in $city $delimiter$data $temperature $scale $icon$dashes$text Humidity $delimiter$data $humidity % $dashes$text Wind $delimiter$data $wind $speed_unit $dashes$text Pressure $delimiter$data $pressure hPa \033[0m" +echo -e "$background$text Current weather in $city $delimiter$data $temperature $scale $icon$dashes$text Humidity $delimiter$data $humidity % $dashes$text Wind $delimiter$data $wind $speed_unit $dashes$text Pressure $delimiter$data $pressure $pressureUnit \033[0m"