From 4137424b700e20be4a7331bacf58da54fb9178ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 22 Aug 2024 20:01:35 +0300 Subject: [PATCH 1/3] Fix bash-function: Fix under zsh --- share/bash-function.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/bash-function.txt b/share/bash-function.txt index 69bbfef..f25cd92 100644 --- a/share/bash-function.txt +++ b/share/bash-function.txt @@ -20,7 +20,7 @@ fi wttr() { local location="${1// /+}" - command shift + shift local args="" for p in $WTTR_PARAMS "$@"; do args+=" --data-urlencode $p " From 99a5f9995fda0e40a084fd222244e87c8fec58bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 22 Aug 2024 20:04:52 +0300 Subject: [PATCH 2/3] Update bash-function: Skip shift if no args --- share/bash-function.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/bash-function.txt b/share/bash-function.txt index f25cd92..0bbb414 100644 --- a/share/bash-function.txt +++ b/share/bash-function.txt @@ -20,7 +20,7 @@ fi wttr() { local location="${1// /+}" - shift + test "$#" -gt 0 && shift local args="" for p in $WTTR_PARAMS "$@"; do args+=" --data-urlencode $p " From 3187f50504c4e142b7bfdb046c04cc90e567e376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 22 Aug 2024 20:12:50 +0300 Subject: [PATCH 3/3] Update bash-function: Fix curl error curl: (3) URL using bad/illegal format or missing URL --- share/bash-function.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/bash-function.txt b/share/bash-function.txt index 0bbb414..8b857c5 100644 --- a/share/bash-function.txt +++ b/share/bash-function.txt @@ -21,11 +21,11 @@ fi wttr() { local location="${1// /+}" test "$#" -gt 0 && shift - local args="" + local args=() for p in $WTTR_PARAMS "$@"; do - args+=" --data-urlencode $p " + args+=("--data-urlencode" "$p") done - curl -fGsS -H "Accept-Language: ${LANG%_*}" $args --compressed "wttr.in/${location}" + curl -fGsS -H "Accept-Language: ${LANG%_*}" "${args[@]}" --compressed "wttr.in/${location}" } wttr "$@"