aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-03-27 21:28:18 +0000
committerMike Frysinger <vapier@gentoo.org>2012-03-27 21:28:18 +0000
commit58bfcae1f04442827dcca05614cf62f81a935474 (patch)
tree48e078437b7d5ab3ced986ee470a534133a12702
parentadd an error() helper (diff)
downloadbuild-docbook-catalog-58bfcae1f04442827dcca05614cf62f81a935474.tar.gz
build-docbook-catalog-58bfcae1f04442827dcca05614cf62f81a935474.tar.bz2
build-docbook-catalog-58bfcae1f04442827dcca05614cf62f81a935474.zip
add -h/--help options
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rwxr-xr-xbuild-docbook-catalog27
1 files changed, 22 insertions, 5 deletions
diff --git a/build-docbook-catalog b/build-docbook-catalog
index c80796b..6e19ebf 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -1,5 +1,5 @@
#!/bin/bash
-# $Header: /usr/local/src/gentoo/gentoo-src/cvsroot/gentoo-src/build-docbook-catalog/build-docbook-catalog,v 1.8 2012/03/27 21:23:00 vapier Exp $
+# $Header: /usr/local/src/gentoo/gentoo-src/cvsroot/gentoo-src/build-docbook-catalog/build-docbook-catalog,v 1.9 2012/03/27 21:28:18 vapier Exp $
#
# build-docbook-catalog: populate /etc/xml/docbook based in
# installed docbook-xml-dtd versions.
@@ -19,19 +19,36 @@ VERBOSE=false
ZERO=${0##*/}
#
+# usage!
+#
+usage() {
+ cat <<-EOF
+ Usage: ${ZERO} [options]
+
+ Options:
+ -v, --verbose Be verbose
+ -h, --help This!
+ EOF
+ [[ $# -gt 0 ]] && eerror "$*"
+ exit 0
+}
+
+#
# main (called from bottom)
#
main() {
typeset d v opts
- opts=$(getopt -o v --long verbose -n "$ZERO" -- "$@") || exit 1
+ opts=$(getopt -o hv --long help,verbose -n "$ZERO" -- "$@") || exit 1
eval set -- "$opts"
while true; do
case "$1" in
- -v|--verbose) VERBOSE=true ; shift ;;
- --) shift ; break ;;
- *) error "options parsing failed on $1!" ;;
+ -h|--help) usage ;;
+ -v|--verbose) VERBOSE=true ;;
+ --) break ;;
+ *) usage "options parsing failed on $1!" ;;
esac
+ shift
done
create_catalogs # will exit on error