mirror of
https://github.com/neoromantique/dotfiles.git
synced 2026-04-17 08:31:00 +03:00
19 lines
283 B
Bash
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 '{}'
|