Document some more
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
ca8db6208f
commit
f8a7f09627
11
bollux
11
bollux
|
@ -372,11 +372,20 @@ uwellform() {
|
|||
# directly from RFC 3986, Appendix B -- and if the URL provided doesn't match
|
||||
# it, the function bails.
|
||||
#
|
||||
# `usplit' takes advantage ... [CONTINUE HERE]
|
||||
# `usplit' takes advantage of bash's regex abilities: when the regex comparison
|
||||
# operator `=~' is used, bash populates the array $BASH_REMATCH with the groups
|
||||
# matched, and ${BASH_REMATCH[0]} is the entirety of the match. So `usplit'
|
||||
# takes the matched URL, splits it using the regex, then assigns each part to an
|
||||
# element of the url array NAME by using `printf -v', which prints to a
|
||||
# variable.
|
||||
usplit() { # usplit NAME:ARRAY URL:STRING
|
||||
local re='^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?'
|
||||
[[ $2 =~ $re ]] || return $?
|
||||
|
||||
# ShellCheck doesn't see that I'm using these variables in the `for'
|
||||
# loop below, because I'm not technically using them /as/ variables, but
|
||||
# as names to the variables. The ${!c} formation in the `printf' call
|
||||
# below performs a reverse lookup on the name to get the actual data.
|
||||
# shellcheck disable=2034
|
||||
local url="${BASH_REMATCH[0]}" \
|
||||
scheme="${BASH_REMATCH[2]}" \
|
||||
|
|
Loading…
Reference in New Issue