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
1 changed files with 3 additions and 7 deletions

10
urchin
View File

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