Add usage and header
authorCase Duckworth <acdw@acdw.net>
Tue, 26 May 2020 02:41:42 +0000 (21:41 -0500)
committerCase Duckworth <acdw@acdw.net>
Tue, 26 May 2020 02:41:42 +0000 (21:41 -0500)
bollux

diff --git a/bollux b/bollux
index abd0ab9..f9ebdb6 100755 (executable)
--- a/bollux
+++ b/bollux
@@ -1,4 +1,8 @@
 #!/usr/bin/env bash
+# bollux: a bash gemini client
+# Author: Case Duckworth
+# License: MIT
+# Version: 0.1
 
 # Program information
 PRGN="${0##*/}"
@@ -6,6 +10,22 @@ VRSN=0.1
 # State
 REDIRECTS=0
 
+bollux_usage() {
+       cat <<END
+$PRGN (v. $VRSN): a bash gemini client
+usage:
+       $PRGN [-h]
+       $PRGN [-q] [-v] [URL]
+flags:
+       -h      show this help and exit
+       -q      be quiet: log no messages
+       -v      verbose: log more messages
+parameters:
+       URL     the URL to start in
+               If not provided, the user will be prompted.
+END
+}
+
 run() {
        log debug "$@"
        "$@"
@@ -49,8 +69,12 @@ bollux() {
 }
 
 bollux_args() {
-       while getopts :vq OPT; do
+       while getopts :hvq OPT; do
                case "$OPT" in
+               h)
+                       bollux_usage
+                       exit
+                       ;;
                v) BOLLUX_LOGLEVEL=DEBUG ;;
                q) BOLLUX_LOGLEVEL=QUIET ;;
                :) die 1 "Option -$OPTARG requires an argument" ;;