From ace5aa5c97ff5965354f6e350a15b8e7295c9c91 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 23 May 2020 19:45:21 -0500 Subject: Add usage() --- bollux | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/bollux b/bollux index 05c916b..b63e645 100755 --- a/bollux +++ b/bollux @@ -4,14 +4,36 @@ # 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 <&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 -- cgit 1.4.1-21-gabe81