diff options
-rwxr-xr-x | bollux | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/bollux b/bollux index 05c916b..b63e645 100755 --- a/bollux +++ b/bollux | |||
@@ -4,14 +4,36 @@ | |||
4 | # License: MIT | 4 | # License: MIT |
5 | # Version: -0.7 | 5 | # Version: -0.7 |
6 | 6 | ||
7 | # set -euo pipefail # strict mode | ||
8 | |||
7 | ### constants ### | 9 | ### constants ### |
8 | PRGN="${0##*/}" # program name | 10 | PRGN="${0##*/}" # program name |
9 | DLDR="${BOLLUX_DOWNDIR:-.}" # where to download | 11 | DLDR="${BOLLUX_DOWNDIR:=.}" # where to download |
10 | LOGL="${BOLLUX_LOGLEVEL:-3}" # log level | 12 | LOGL="${BOLLUX_LOGLEVEL:=3}" # log level |
11 | MAXR="${BOLLUX_MAXREDIR:-5}" # max redirects | 13 | MAXR="${BOLLUX_MAXREDIR:=5}" # max redirects |
12 | PORT="${BOLLUX_PORT:-1965}" # port number | 14 | PORT="${BOLLUX_PORT:=1965}" # port number |
13 | PROT="${BOLLUX_PROTO:-gemini}" # protocol | 15 | PROT="${BOLLUX_PROTO:=gemini}" # protocol |
14 | RDRS=0 # redirects | 16 | RDRS=0 # redirects |
17 | VRSN=-0.7 # version number | ||
18 | |||
19 | # shellcheck disable=2120 | ||
20 | bollux_usage() { | ||
21 | cat <<END_USAGE >&2 | ||
22 | $PRGN ($VRSN): a bash gemini client | ||
23 | usage: | ||
24 | $PRGN [-h] | ||
25 | $PRGN [-L LVL] [URL] | ||
26 | options: | ||
27 | -h show this help | ||
28 | -L LVL set the loglevel to LVL. | ||
29 | Default: $BOLLUX_LOGLEVEL | ||
30 | The loglevel is between 0 and 5, with | ||
31 | lower levels being more dire. | ||
32 | parameters: | ||
33 | URL the URL to navigate view or download | ||
34 | END_USAGE | ||
35 | exit "${1:-0}" | ||
36 | } | ||
15 | 37 | ||
16 | # LOGLEVELS: | 38 | # LOGLEVELS: |
17 | # 0 - application fatal error | 39 | # 0 - application fatal error |