ports/misc/ansiweather/files/patch-ansiweather
Bartek Rutkowski 156a6ec0fc misc/ansiweather: update 1.08 -> 1.09
PR:		213629
Submitted by:	Danilo G. Baio <dbaio@bsd.com.br> (maintainer)
2016-11-09 11:19:20 +00:00

50 lines
1.7 KiB
Text

--- ansiweather.orig 2016-10-18 17:14:59 UTC
+++ ansiweather
@@ -205,7 +205,7 @@ then
forecast=$([ "$forecast" -gt "$flength" ] && echo "$flength" || echo "$forecast")
else
city=$(echo "$weather" | jq -r '.name')
- temperature=$(echo "$weather" | jq '.main.temp' | xargs printf "%.0f")
+ temperature=$(echo "$weather" | jq '.main.temp' | xargs gprintf "%.0f")
humidity=$(echo "$weather" | jq '.main.humidity')
pressure=$(echo "$weather" | jq '.main.pressure')
sky=$(echo "$weather" | jq -r '.weather[0].main')
@@ -285,7 +285,7 @@ case $units in
scale="°C"
speed_unit="m/s"
pressure_unit="hPa"
- pressure=$(echo "$pressure" | xargs printf "%.0f")
+ pressure=$(echo "$pressure" | xargs gprintf "%.0f")
;;
imperial)
scale="°F"
@@ -293,7 +293,7 @@ case $units in
pressure_unit="inHg"
if [ "$forecast" = 0 ]
then
- pressure=$(echo "$pressure*0.0295" | bc | xargs printf "%.2f")
+ pressure=$(echo "$pressure*0.0295" | bc | xargs gprintf "%.2f")
fi
;;
esac
@@ -349,8 +349,8 @@ then
do
day=$(echo "$weather" | jq ".list[$i]")
date=$(epoch_to_date "$(echo "$day" | jq -r '.dt')")
- low=$(echo "$day" | jq -r '.temp.min' | xargs printf "%.0f")
- high=$(echo "$day" | jq -r '.temp.max' | xargs printf "%.0f")
+ low=$(echo "$day" | jq -r '.temp.min' | xargs gprintf "%.0f")
+ high=$(echo "$day" | jq -r '.temp.max' | xargs gprintf "%.0f")
icon=""
if [ "$symbols" = true ]
@@ -397,7 +397,7 @@ fi
if [ "$ansi" = true ]
then
- env printf "$output\033[0m\n"
+ env gprintf "$output\033[0m\n"
else
- env printf "$output\n" | sed "s/$(printf '\033')\[[0-9;]*m//g"
+ env gprintf "$output\n" | sed "s/$(gprintf '\033')\[[0-9;]*m//g"
fi