Add helpful --help option and give usage on bogus options.

This commit is contained in:
David Jones 2013-06-18 22:21:31 +01:00
parent 40f9a967c3
commit feb2f1c26c

10
urchin
View File

@ -84,7 +84,6 @@ urchin_help() {
echo echo
echo 'Go to http://www.urchin.sh for documentation on writing tests.' echo 'Go to http://www.urchin.sh for documentation on writing tests.'
echo echo
exit 0
} }
urchin_go() { urchin_go() {
@ -109,15 +108,15 @@ urchin_molly_guard() {
} }
FORCE=false FORCE=false
HELP=false
while [ $# -gt 0 ] while [ $# -gt 0 ]
do do
case "$1" in case "$1" in
-f) FORCE=true;; -f) FORCE=true;;
-h) HELP=true;; -h|--help) urchin_help
exit 0;;
# --xsd) action=testsuite;; # --xsd) action=testsuite;;
# --) shift; break;; # --) shift; break;;
-*) echo >&2 $USAGE -*) urchin_help 1>&2
exit 1;; exit 1;;
*) break;; *) break;;
esac esac
@ -128,9 +127,6 @@ done
logfile=$(fullpath "$1")/.urchin.log logfile=$(fullpath "$1")/.urchin.log
stdout_file=/tmp/urchin_stdout stdout_file=/tmp/urchin_stdout
# Help first
$HELP && urchin_help
# Verify argument for main stuff # Verify argument for main stuff
if [ "$#" != '1' ] && [ ! -d "$1" ] if [ "$#" != '1' ] && [ ! -d "$1" ]
then then