summaryrefslogtreecommitdiff
path: root/misc/ansiweather/files/patch-ansiweather
blob: 9e797657fb2b2371c1941916462751573f1eec58 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--- 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