Files
neoromantique-dotfiles/home/dot_local/bin/executable_qs-weather-fetch
David Aizenberg f1f2ba2bbe sync
2026-03-17 20:08:29 +01:00

19 lines
283 B
Bash

#!/usr/bin/env bash
set -euo pipefail
loc="${1:-}"
if [ -z "$loc" ]; then
echo '{}'
exit 0
fi
encoded="$(python3 - "$loc" <<'PY'
import sys
import urllib.parse
print(urllib.parse.quote_plus(sys.argv[1]))
PY
)"
curl -sf "wttr.in/${encoded}?format=j1" 2>/dev/null || echo '{}'