diff options
author | Case Duckworth | 2021-02-25 21:37:30 -0600 |
---|---|---|
committer | Case Duckworth | 2021-02-25 21:37:30 -0600 |
commit | 83af2d5cd74fb2f56ea91ab0b5331869a0dc0e49 (patch) | |
tree | 4a143d8ae7455eafc5f89badfef1e09e6b7837cf | |
parent | Correct URL (diff) | |
download | bollux-83af2d5cd74fb2f56ea91ab0b5331869a0dc0e49.tar.gz bollux-83af2d5cd74fb2f56ea91ab0b5331869a0dc0e49.zip |
Disable shellcheck in usplit
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.
-rwxr-xr-x | bollux | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/bollux b/bollux index 2d206b1..d58aac3 100755 --- a/bollux +++ b/bollux | |||
@@ -223,11 +223,12 @@ usplit() { # usplit NAME:ARRAY URL:STRING | |||
223 | local re='^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?' | 223 | local re='^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?' |
224 | [[ $2 =~ $re ]] || return $? | 224 | [[ $2 =~ $re ]] || return $? |
225 | 225 | ||
226 | local scheme="${BASH_REMATCH[2]}" | 226 | # shellcheck disable=2034 |
227 | local authority="${BASH_REMATCH[4]}" | 227 | local scheme="${BASH_REMATCH[2]}" \ |
228 | local path="${BASH_REMATCH[5]}" | 228 | authority="${BASH_REMATCH[4]}" \ |
229 | local query="${BASH_REMATCH[7]}" | 229 | path="${BASH_REMATCH[5]}" \ |
230 | local fragment="${BASH_REMATCH[9]}" | 230 | query="${BASH_REMATCH[7]}" \ |
231 | fragment="${BASH_REMATCH[9]}" | ||
231 | 232 | ||
232 | # 0=url 1=scheme 2=authority 3=path 4=query 5=fragment | 233 | # 0=url 1=scheme 2=authority 3=path 4=query 5=fragment |
233 | local i=1 c | 234 | local i=1 c |
@@ -235,10 +236,12 @@ usplit() { # usplit NAME:ARRAY URL:STRING | |||
235 | if [[ "${!c}" || "$c" == path ]]; then | 236 | if [[ "${!c}" || "$c" == path ]]; then |
236 | printf -v "$1[$i]" '%s' "${!c}" | 237 | printf -v "$1[$i]" '%s' "${!c}" |
237 | else | 238 | else |
239 | # shellcheck disable=2059 | ||
238 | printf -v "$1[$i]" "$UC_BLANK" | 240 | printf -v "$1[$i]" "$UC_BLANK" |
239 | fi | 241 | fi |
240 | ((i += 1)) | 242 | ((i += 1)) |
241 | done | 243 | done |
244 | # shellcheck disable=2059 | ||
242 | printf -v "$1[0]" "$(ujoin "$1")" # inefficient I'm sure | 245 | printf -v "$1[0]" "$(ujoin "$1")" # inefficient I'm sure |
243 | } | 246 | } |
244 | 247 | ||