diff options
author | Case Duckworth | 2021-02-25 19:36:14 -0600 |
---|---|---|
committer | Case Duckworth | 2021-02-25 19:36:14 -0600 |
commit | 556d5d241f80301cd4f0be5cdbe35fd19571689d (patch) | |
tree | f26449eba15a7289319257284e67c47c93dbb276 | |
parent | Merge pull request 'add shellcheck with drone' (#8) from ben/bollux:drone-she... (diff) | |
download | bollux-556d5d241f80301cd4f0be5cdbe35fd19571689d.tar.gz bollux-556d5d241f80301cd4f0be5cdbe35fd19571689d.zip |
Run shfmt on the buffer
-rwxr-xr-x | bollux | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/bollux b/bollux index 51ca597..dcf81ae 100755 --- a/bollux +++ b/bollux | |||
@@ -129,8 +129,8 @@ bollux_config() { | |||
129 | : "${BOLLUX_PAGESRC:=$BOLLUX_DATADIR/pagesrc}" # where to save the source | 129 | : "${BOLLUX_PAGESRC:=$BOLLUX_DATADIR/pagesrc}" # where to save the source |
130 | BOLLUX_HISTFILE="$BOLLUX_DATADIR/history" # where to save the history | 130 | BOLLUX_HISTFILE="$BOLLUX_DATADIR/history" # where to save the history |
131 | ## typesetting | 131 | ## typesetting |
132 | : "${T_MARGIN:=4}" # left and right margin | 132 | : "${T_MARGIN:=4}" # left and right margin |
133 | : "${T_WIDTH:=0}" # width of the viewport -- 0 = get term width | 133 | : "${T_WIDTH:=0}" # width of the viewport -- 0 = get term width |
134 | # colors -- these will be wrapped in \e[ __ m | 134 | # colors -- these will be wrapped in \e[ __ m |
135 | C_RESET='\e[0m' # reset | 135 | C_RESET='\e[0m' # reset |
136 | : "${C_SIGIL:=35}" # sigil (=>, #, ##, ###, *, ```) | 136 | : "${C_SIGIL:=35}" # sigil (=>, #, ##, ###, *, ```) |
@@ -209,7 +209,7 @@ blastoff() { # blastoff [-u] URL | |||
209 | ## https://tools.ietf.org/html/rfc3986 | 209 | ## https://tools.ietf.org/html/rfc3986 |
210 | uwellform() { | 210 | uwellform() { |
211 | local u="$1" | 211 | local u="$1" |
212 | 212 | ||
213 | if [[ "$u" != *://* ]]; then | 213 | if [[ "$u" != *://* ]]; then |
214 | u="$BOLLUX_PROTO://$u" | 214 | u="$BOLLUX_PROTO://$u" |
215 | fi | 215 | fi |
@@ -237,7 +237,7 @@ usplit() { # usplit NAME:ARRAY URL:STRING | |||
237 | else | 237 | else |
238 | printf -v "$1[$i]" "$UC_BLANK" | 238 | printf -v "$1[$i]" "$UC_BLANK" |
239 | fi | 239 | fi |
240 | ((i+=1)) | 240 | ((i += 1)) |
241 | done | 241 | done |
242 | printf -v "$1[0]" "$(ujoin "$1")" # inefficient I'm sure | 242 | printf -v "$1[0]" "$(ujoin "$1")" # inefficient I'm sure |
243 | } | 243 | } |
@@ -254,7 +254,7 @@ ujoin() { # ujoin NAME:ARRAY | |||
254 | fi | 254 | fi |
255 | 255 | ||
256 | printf -v U[0] "${U[0]}%s" "${U[3]}" | 256 | printf -v U[0] "${U[0]}%s" "${U[3]}" |
257 | 257 | ||
258 | if ucdef U[4]; then | 258 | if ucdef U[4]; then |
259 | printf -v U[0] "${U[0]}?%s" "${U[4]}" | 259 | printf -v U[0] "${U[0]}?%s" "${U[4]}" |
260 | fi | 260 | fi |
@@ -268,19 +268,19 @@ ujoin() { # ujoin NAME:ARRAY | |||
268 | 268 | ||
269 | ucdef() { [[ "${!1}" != "$UC_BLANK" ]]; } # ucdef NAME | 269 | ucdef() { [[ "${!1}" != "$UC_BLANK" ]]; } # ucdef NAME |
270 | ucblank() { [[ -z "${!1}" ]]; } # ucblank NAME | 270 | ucblank() { [[ -z "${!1}" ]]; } # ucblank NAME |
271 | ucset() { # ucset NAME VALUE | 271 | ucset() { # ucset NAME VALUE |
272 | run eval "${1}='$2'" | 272 | run eval "${1}='$2'" |
273 | run ujoin "${1/\[*\]}" | 273 | run ujoin "${1/\[*\]/}" |
274 | } | 274 | } |
275 | 275 | ||
276 | utransform() { # utransform TARGET:ARRAY BASE:STRING REFERENCE:STRING | 276 | utransform() { # utransform TARGET:ARRAY BASE:STRING REFERENCE:STRING |
277 | local -a B R # base, reference | 277 | local -a B R # base, reference |
278 | local -n T="$1" # target | 278 | local -n T="$1" # target |
279 | usplit B "$2" | 279 | usplit B "$2" |
280 | usplit R "$3" | 280 | usplit R "$3" |
281 | 281 | ||
282 | # initialize T | 282 | # initialize T |
283 | for ((i=1;i<=5;i++)); do | 283 | for ((i = 1; i <= 5; i++)); do |
284 | T[$i]="$UC_BLANK" | 284 | T[$i]="$UC_BLANK" |
285 | done | 285 | done |
286 | 286 | ||
@@ -396,7 +396,7 @@ uencode() { # uencode URL:STRING | |||
396 | } | 396 | } |
397 | 397 | ||
398 | # https://github.com/dylanaraps/pure-bash-bible/ | 398 | # https://github.com/dylanaraps/pure-bash-bible/ |
399 | udecode() { # udecode URL:STRING | 399 | udecode() { # udecode URL:STRING |
400 | : "${1//+/ }" | 400 | : "${1//+/ }" |
401 | printf '%b\n' "${_//%/\\x}" | 401 | printf '%b\n' "${_//%/\\x}" |
402 | } | 402 | } |
@@ -419,10 +419,10 @@ gemini_request() { # gemini_request URL | |||
419 | fi | 419 | fi |
420 | 420 | ||
421 | local ssl_cmd=( | 421 | local ssl_cmd=( |
422 | openssl s_client | 422 | openssl s_client |
423 | -crlf -quiet -connect "${url[2]}:$port" | 423 | -crlf -quiet -connect "${url[2]}:$port" |
424 | -servername "${url[2]}" # SNI | 424 | -servername "${url[2]}" # SNI |
425 | -no_ssl3 -no_tls1 -no_tls1_1 # disable old TLS/SSL versions | 425 | -no_ssl3 -no_tls1 -no_tls1_1 # disable old TLS/SSL versions |
426 | ) | 426 | ) |
427 | 427 | ||
428 | run "${ssl_cmd[@]}" <<<"$url" | 428 | run "${ssl_cmd[@]}" <<<"$url" |
@@ -671,9 +671,9 @@ display() { # display METADATA [TITLE] | |||
671 | local helpline="o:open, g/G:goto, [:back, ]:forward, r:refresh" | 671 | local helpline="o:open, g/G:goto, [:back, ]:forward, r:refresh" |
672 | less_cmd+=( | 672 | less_cmd+=( |
673 | -Pm"$(less_prompt_escape "$BOLLUX_URL") - bollux$" # 'status'line | 673 | -Pm"$(less_prompt_escape "$BOLLUX_URL") - bollux$" # 'status'line |
674 | -P="$(less_prompt_escape "$helpline")$" # helpline | 674 | -P="$(less_prompt_escape "$helpline")$" # helpline |
675 | -m # start with statusline | 675 | -m # start with statusline |
676 | +k # float content to the top | 676 | +k # float content to the top |
677 | ) | 677 | ) |
678 | 678 | ||
679 | local typeset | 679 | local typeset |