Disable shellcheck in usplit
continuous-integration/drone/push Build is passing Details

The local variables aren't picked up by shellcheck because of the printf level
of indirection I do later in the function, which is the reason /why/ I use a
variable in the first argument to printf.
This commit is contained in:
Case Duckworth 2021-02-25 21:37:30 -06:00
parent 7166fed540
commit 83af2d5cd7
1 changed files with 8 additions and 5 deletions

13
bollux
View File

@ -223,11 +223,12 @@ usplit() { # usplit NAME:ARRAY URL:STRING
local re='^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?'
[[ $2 =~ $re ]] || return $?
local scheme="${BASH_REMATCH[2]}"
local authority="${BASH_REMATCH[4]}"
local path="${BASH_REMATCH[5]}"
local query="${BASH_REMATCH[7]}"
local fragment="${BASH_REMATCH[9]}"
# shellcheck disable=2034
local scheme="${BASH_REMATCH[2]}" \
authority="${BASH_REMATCH[4]}" \
path="${BASH_REMATCH[5]}" \
query="${BASH_REMATCH[7]}" \
fragment="${BASH_REMATCH[9]}"
# 0=url 1=scheme 2=authority 3=path 4=query 5=fragment
local i=1 c
@ -235,10 +236,12 @@ usplit() { # usplit NAME:ARRAY URL:STRING
if [[ "${!c}" || "$c" == path ]]; then
printf -v "$1[$i]" '%s' "${!c}"
else
# shellcheck disable=2059
printf -v "$1[$i]" "$UC_BLANK"
fi
((i += 1))
done
# shellcheck disable=2059
printf -v "$1[0]" "$(ujoin "$1")" # inefficient I'm sure
}