summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-08-04 19:57:29 +0200
committertv <tv@krebsco.de>2026-08-04 19:57:29 +0200
commit664d686b0293fd8ba427d0aa9ea63ca7e75a938f (patch)
treeb971ba3ea6b3352861d7ec6bffdb88d6b388e5f3
parent74fdfc5cb2fa4f175154a87dc9d9eb838495462d (diff)
swap long and lat in argument
-rwxr-xr-xwetter10
1 files changed, 6 insertions, 4 deletions
diff --git a/wetter b/wetter
index 0114305..6f5ac19 100755
--- a/wetter
+++ b/wetter
@@ -5,7 +5,7 @@
# wetter - client for api.weather.mg
#
# SYNOPSIS
-# wetter [LONGITUDE,LATITUDE]
+# wetter [LATITUDE,LONGITUDE]
#
# ENVIRONMENT
# WETTER_CACHE_DIR (default: $XDG_CACHE_HOME/wetter or nothing)
@@ -23,12 +23,12 @@
set -efu
-# main [LONGITUDE,LATITUDE]
+# main [LATITUDE,LONGITUDE]
main() {
- locatedAt=${WETTER_LOCATION-13.42013,52.51297} # default: c-base
+ location_spec=${WETTER_DEFAULT_LOCATION-52.51297,13.42013} # default: c-base
if test $# = 1; then
- locatedAt=$1
+ location_spec=$1
fi
token_url=${WETTER_TOKEN_URL-https://api.weatherpro.com/v1/token/weather}
@@ -62,6 +62,8 @@ main() {
join(",")
')
+ locatedAt=$(echo "$location_spec" | awk -F, '{print$2","$1}')
+
validFrom=$(date -d 'TZ="Europe/Berlin" - 48 hours' --utc +'%Y-%m-%dT%H:%M:%S.%3NZ')
validUntil=$(date -d "TZ=\"Europe/Berlin\" + $(( 5 * 24 )) hours" --utc +'%Y-%m-%dT%H:%M:%S.%3NZ')