Update bash-function: Fix curl error

curl: (3) URL using bad/illegal format or missing URL
This commit is contained in:
Elan Ruusamäe 2024-08-22 20:12:50 +03:00 committed by GitHub
parent 99a5f9995f
commit 3187f50504
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,11 +21,11 @@ fi
wttr() { wttr() {
local location="${1// /+}" local location="${1// /+}"
test "$#" -gt 0 && shift test "$#" -gt 0 && shift
local args="" local args=()
for p in $WTTR_PARAMS "$@"; do for p in $WTTR_PARAMS "$@"; do
args+=" --data-urlencode $p " args+=("--data-urlencode" "$p")
done done
curl -fGsS -H "Accept-Language: ${LANG%_*}" $args --compressed "wttr.in/${location}" curl -fGsS -H "Accept-Language: ${LANG%_*}" "${args[@]}" --compressed "wttr.in/${location}"
} }
wttr "$@" wttr "$@"