From 18da6658d2ed53abb4cbac232eec742cf743ad8e Mon Sep 17 00:00:00 2001 From: aheirman <48590738+aheirman@users.noreply.github.com> Date: Wed, 17 Feb 2021 20:04:49 +0100 Subject: [PATCH] Add help to iglu.sh --- iglu.sh | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/iglu.sh b/iglu.sh index f8c9ab3..9161d6c 100755 --- a/iglu.sh +++ b/iglu.sh @@ -1,11 +1,34 @@ #!/bin/sh + + + +HELP=" + -h This help window + --help alias to \`-h\` + + -i install + -u uninstall + -l outputs the license + -f lists installed files + -d list dependencies + -iu install update or install upgrade + -ui alias to \`-iu\` + +NOT IMPLEMENTED: + -o root" + + + usage() { - echo $(basename "$0"): ERROR: "$@" 1>&2 - echo usage: $(basename "$0") '([-i]|[-u]|[-f]|[-l]) [-o root] - [pkg.tar]' 1>&2 + echo usage: $(basename "$0") printf "${HELP}" 1>&2 exit 1 } +error_usage() { + echo $(basename "$0"): ERROR: "$@" 1>&2 + usage +} + tar_fail() { echo "Failed to extract tar" exit 1 @@ -45,6 +68,9 @@ dep_not_found() { i= u= l= f= o= d= iu= + + +# Handle commandline arguments. case "$1" in -i) i=1;; -u) u=1;; @@ -53,7 +79,11 @@ case "$1" in -d) d=1;; -iu) iu=1;; -ui) iu=1;; - *) usage "bad argument $i";; + + -h) usage;; + --help) usage;; + + *) error_usage "bad argument $i";; esac shift