diff options
-rw-r--r-- | bollux | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/bollux b/bollux index c33ba6e..da93e43 100644 --- a/bollux +++ b/bollux | |||
@@ -378,11 +378,12 @@ usplit() { # usplit NAME:ARRAY URL:STRING | |||
378 | [[ $2 =~ $re ]] || return $? | 378 | [[ $2 =~ $re ]] || return $? |
379 | 379 | ||
380 | # shellcheck disable=2034 | 380 | # shellcheck disable=2034 |
381 | local scheme="${BASH_REMATCH[2]}" \ | 381 | local url="${BASH_REMATCH[0]}" \ |
382 | authority="${BASH_REMATCH[4]}" \ | 382 | scheme="${BASH_REMATCH[2]}" \ |
383 | path="${BASH_REMATCH[5]}" \ | 383 | authority="${BASH_REMATCH[4]}" \ |
384 | query="${BASH_REMATCH[7]}" \ | 384 | path="${BASH_REMATCH[5]}" \ |
385 | fragment="${BASH_REMATCH[9]}" | 385 | query="${BASH_REMATCH[7]}" \ |
386 | fragment="${BASH_REMATCH[9]}" | ||
386 | 387 | ||
387 | # 0=url 1=scheme 2=authority 3=path 4=query 5=fragment | 388 | # 0=url 1=scheme 2=authority 3=path 4=query 5=fragment |
388 | local i=1 c | 389 | local i=1 c |
@@ -390,13 +391,11 @@ usplit() { # usplit NAME:ARRAY URL:STRING | |||
390 | if [[ "${!c}" || "$c" == path ]]; then | 391 | if [[ "${!c}" || "$c" == path ]]; then |
391 | printf -v "$1[$i]" '%s' "${!c}" | 392 | printf -v "$1[$i]" '%s' "${!c}" |
392 | else | 393 | else |
393 | # shellcheck disable=2059 | 394 | printf -v "$1[$i]" '%s' "$UC_BLANK" |
394 | printf -v "$1[$i]" "$UC_BLANK" | ||
395 | fi | 395 | fi |
396 | ((i += 1)) | 396 | ((i += 1)) |
397 | done | 397 | done |
398 | # shellcheck disable=2059 | 398 | printf -v "$1[0]" '%s' "$url" |
399 | printf -v "$1[0]" "$(ujoin "$1")" # inefficient I'm sure | ||
400 | } | 399 | } |
401 | 400 | ||
402 | ujoin() { # ujoin NAME:ARRAY | 401 | ujoin() { # ujoin NAME:ARRAY |