about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-03-02 17:58:44 -0600
committerCase Duckworth2021-03-02 17:58:44 -0600
commitf8a7f09627aedda84984828f6b3fcb0c5b716bb9 (patch)
treeb71cca60e16b7330ed97098ece255885af2366eb
parentFix tiny bugs (diff)
downloadbollux-f8a7f09627aedda84984828f6b3fcb0c5b716bb9.tar.gz
bollux-f8a7f09627aedda84984828f6b3fcb0c5b716bb9.zip
Document some more
-rw-r--r--bollux11
1 files changed, 10 insertions, 1 deletions
diff --git a/bollux b/bollux index da93e43..a57e060 100644 --- a/bollux +++ b/bollux
@@ -372,11 +372,20 @@ uwellform() {
372# directly from RFC 3986, Appendix B -- and if the URL provided doesn't match 372# directly from RFC 3986, Appendix B -- and if the URL provided doesn't match
373# it, the function bails. 373# it, the function bails.
374# 374#
375# `usplit' takes advantage ... [CONTINUE HERE] 375# `usplit' takes advantage of bash's regex abilities: when the regex comparison
376# operator `=~' is used, bash populates the array $BASH_REMATCH with the groups
377# matched, and ${BASH_REMATCH[0]} is the entirety of the match. So `usplit'
378# takes the matched URL, splits it using the regex, then assigns each part to an
379# element of the url array NAME by using `printf -v', which prints to a
380# variable.
376usplit() { # usplit NAME:ARRAY URL:STRING 381usplit() { # usplit NAME:ARRAY URL:STRING
377 local re='^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?' 382 local re='^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?'
378 [[ $2 =~ $re ]] || return $? 383 [[ $2 =~ $re ]] || return $?
379 384
385 # ShellCheck doesn't see that I'm using these variables in the `for'
386 # loop below, because I'm not technically using them /as/ variables, but
387 # as names to the variables. The ${!c} formation in the `printf' call
388 # below performs a reverse lookup on the name to get the actual data.
380 # shellcheck disable=2034 389 # shellcheck disable=2034
381 local url="${BASH_REMATCH[0]}" \ 390 local url="${BASH_REMATCH[0]}" \
382 scheme="${BASH_REMATCH[2]}" \ 391 scheme="${BASH_REMATCH[2]}" \