Add help to iglu.sh

This commit is contained in:
aheirman 2021-02-17 20:04:49 +01:00 committed by GitHub
parent f714464e34
commit 18da6658d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 34 additions and 4 deletions

38
iglu.sh
View File

@ -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