Lines 1-38
Link Here
|
1 |
--- ansiweather.orig 2015-07-03 01:51:59 UTC |
1 |
--- ansiweather.orig 2016-01-19 22:01:25 UTC |
2 |
+++ ansiweather |
2 |
+++ ansiweather |
3 |
@@ -203,8 +203,8 @@ then |
3 |
@@ -66,7 +66,7 @@ done |
4 |
do |
4 |
|
5 |
days+=("$(echo $weather | jq ".list[$i]")") |
5 |
if [ "$usage" = true ] |
6 |
dates+=("$(epoch_to_date $(echo ${days[$i]} | jq -r '.dt'))") |
6 |
then |
7 |
- lows+=("$(printf "%0.0f" $(echo ${days[$i]} | jq -r '.temp.min'))") |
7 |
- printf "%s\n" \ |
8 |
- highs+=("$(printf "%0.0f" $(echo ${days[$i]} | jq -r '.temp.max'))") |
8 |
+ gprintf "%s\n" \ |
9 |
+ lows+=("$(gprintf "%0.0f" $(echo ${days[$i]} | jq -r '.temp.min'))") |
9 |
"" \ |
10 |
+ highs+=("$(gprintf "%0.0f" $(echo ${days[$i]} | jq -r '.temp.max'))") |
10 |
"AnsiWeather 1.07" \ |
11 |
humidity+=("$(echo ${days[$i]} | jq -r '.humidity')") |
11 |
"Copyright (c) 2013-2016, Frederic Cambus" \ |
12 |
pressure+=("$(echo ${days[$i]} | jq -r '.pressure')") |
12 |
@@ -223,7 +223,7 @@ then |
13 |
sky+=("$(echo ${days[$i]} | jq -r '.weather[0].main')") |
13 |
forecast=$([ "$forecast" -gt "$flength" ] && echo "$flength" || echo "$forecast") |
14 |
@@ -213,7 +213,7 @@ then |
|
|
15 |
done |
16 |
else |
14 |
else |
17 |
city=$(echo $weather | jq -r '.name') |
15 |
city=$(echo "$weather" | jq -r '.name') |
18 |
- temperature=$(printf '%.0f' $(echo $weather | jq '.main.temp')) |
16 |
- temperature=$(echo "$weather" | jq '.main.temp' | xargs printf "%.0f") |
19 |
+ temperature=$(gprintf '%.0f' $(echo $weather | jq '.main.temp')) |
17 |
+ temperature=$(echo "$weather" | jq '.main.temp' | xargs gprintf "%.0f") |
20 |
humidity=$(echo $weather | jq '.main.humidity') |
18 |
humidity=$(echo "$weather" | jq '.main.humidity') |
21 |
pressure=$(echo $weather | jq '.main.pressure') |
19 |
pressure=$(echo "$weather" | jq '.main.pressure') |
22 |
sky=$(echo $weather | jq -r '.weather[0].main') |
20 |
sky=$(echo "$weather" | jq -r '.weather[0].main') |
23 |
@@ -293,13 +293,13 @@ case $units in |
21 |
@@ -303,7 +303,7 @@ case $units in |
24 |
scale="°C" |
22 |
scale="°C" |
25 |
speed_unit="m/s" |
23 |
speed_unit="m/s" |
26 |
pressure_unit="hPa" |
24 |
pressure_unit="hPa" |
27 |
- pressure=$(printf '%.0f' $pressure) |
25 |
- pressure=$(echo "$pressure" | xargs printf "%.0f") |
28 |
+ pressure=$(gprintf '%.0f' $pressure) |
26 |
+ pressure=$(echo "$pressure" | xargs gprintf "%.0f") |
29 |
;; |
27 |
;; |
30 |
imperial) |
28 |
imperial) |
31 |
scale="°F" |
29 |
scale="°F" |
32 |
speed_unit="mph" |
30 |
@@ -311,7 +311,7 @@ case $units in |
33 |
pressure_unit="inHg" |
31 |
pressure_unit="inHg" |
34 |
- pressure=$(printf '%.2f' $(echo "$pressure*0.0295" | bc)) |
32 |
if [ "$forecast" = 0 ] |
35 |
+ pressure=$(gprintf '%.2f' $(echo "$pressure*0.0295" | bc)) |
33 |
then |
|
|
34 |
- pressure=$(echo "$pressure*0.0295" | bc | xargs printf "%.2f") |
35 |
+ pressure=$(echo "$pressure*0.0295" | bc | xargs gprintf "%.2f") |
36 |
fi |
36 |
;; |
37 |
;; |
37 |
esac |
38 |
esac |
|
|
39 |
@@ -367,8 +367,8 @@ then |
40 |
do |
41 |
day=$(echo "$weather" | jq ".list[$i]") |
42 |
date=$(epoch_to_date "$(echo "$day" | jq -r '.dt')") |
43 |
- low=$(echo "$day" | jq -r '.temp.min' | xargs printf "%.0f") |
44 |
- high=$(echo "$day" | jq -r '.temp.max' | xargs printf "%.0f") |
45 |
+ low=$(echo "$day" | jq -r '.temp.min' | xargs gprintf "%.0f") |
46 |
+ high=$(echo "$day" | jq -r '.temp.max' | xargs gprintf "%.0f") |
38 |
|
47 |
|
|
|
48 |
icon="" |
49 |
if [ "$symbols" = true ] |
50 |
@@ -400,7 +400,7 @@ fi |
51 |
|
52 |
if [ "$ansi" = true ] |
53 |
then |
54 |
- /usr/bin/printf "$output\033[0m\n" |
55 |
+ /usr/local/bin/gprintf "$output\033[0m\n" |
56 |
else |
57 |
- /usr/bin/printf "$output\n" | sed "s/$(printf '\033')\[[0-9;]*m//g" |
58 |
+ /usr/local/bin/gprintf "$output\n" | sed "s/$(gprintf '\033')\[[0-9;]*m//g" |
59 |
fi |