Warning!

Notice: the grml team is migrating from Mercurial to Git.
Please visit git.grml.org instead!

hg-autodoc: added proper help/error messages
authorMichael Gebetsroither <michael.geb@gmx.at>
Fri Nov 30 12:25:38 2007 +0100 (11 months ago)
changeset 526e109097488f
manifest6e109097488f
parent 51c96ede14eca0
child 539be8294522a5
child 54a9315e15b683
hg-autodoc: added proper help/error messages
files/hg-autodoc
--- a/files/hg-autodoc Fri Nov 30 12:00:29 2007 +0100
+++ b/files/hg-autodoc Fri Nov 30 12:25:38 2007 +0100
@@ -11,27 +11,28 @@ Usage: $PROG_NAME [Options] <destination
Usage: $PROG_NAME [Options] <destination of doc files> <source>
Options:
+ -f Force rebuild of dokumentation cache
-e Exclude given projects (<p1>,<p2>, ...)
- -i Ignore file (not implemented yet)
+ -h This help text
EOT
- exit 1
+# -i Ignore files (not implemented yet)
}
function die()
{
echo "$@" >&2
printUsage
- #exit 1
+ exit 1
}
-while getopts "fi:e:" opt; do
+while getopts "fi:e:h" opt; do
case "$opt" in
f) FORCE_REBUILD_='true' ;;
i) OPT_IGNORE_FILE_="$OPTARG"
- die "E: -i not implemented yet"
- ;;
+ die "E: -i not implemented yet" ;;
e) OPT_EXCLUDE_="$OPTARG" ;;
- ?) printUsage; exit 64 ;;
+ h) printUsage; exit 0 ;;
+ ?) die "E: Unknown option \"$opt\"" ;;
esac
done
shift $(($OPTIND - 1)) # set ARGV to the first not parsed commandline parameter
@@ -39,11 +40,10 @@ DST="${1}"
DST="${1}"
SRC="${2:-./}"
if (( $# < 1 || $# > 3 )); then
- printUsage
+ die "E: wrong number of arguments"
fi
if [ -e "$OPT_IGNORE_FILE_" ]; then
- echo "E: no such file: $OPT_IGNORE_FILE_" >&2
- printUsage
+ die "E: no such file: $OPT_IGNORE_FILE_"
fi
if [ -e "$DST" ]; then