# License: MIT
# Version: -0.7
+# set -euo pipefail # strict mode
+
### constants ###
PRGN="${0##*/}" # program name
-DLDR="${BOLLUX_DOWNDIR:-.}" # where to download
-LOGL="${BOLLUX_LOGLEVEL:-3}" # log level
-MAXR="${BOLLUX_MAXREDIR:-5}" # max redirects
-PORT="${BOLLUX_PORT:-1965}" # port number
-PROT="${BOLLUX_PROTO:-gemini}" # protocol
+DLDR="${BOLLUX_DOWNDIR:=.}" # where to download
+LOGL="${BOLLUX_LOGLEVEL:=3}" # log level
+MAXR="${BOLLUX_MAXREDIR:=5}" # max redirects
+PORT="${BOLLUX_PORT:=1965}" # port number
+PROT="${BOLLUX_PROTO:=gemini}" # protocol
RDRS=0 # redirects
+VRSN=-0.7 # version number
+
+# shellcheck disable=2120
+bollux_usage() {
+ cat <<END_USAGE >&2
+ $PRGN ($VRSN): a bash gemini client
+ usage:
+ $PRGN [-h]
+ $PRGN [-L LVL] [URL]
+ options:
+ -h show this help
+ -L LVL set the loglevel to LVL.
+ Default: $BOLLUX_LOGLEVEL
+ The loglevel is between 0 and 5, with
+ lower levels being more dire.
+ parameters:
+ URL the URL to navigate view or download
+END_USAGE
+ exit "${1:-0}"
+}
# LOGLEVELS:
# 0 - application fatal error