summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2007-10-07 19:16:50 +0000
committerMike Frysinger <vapier@gentoo.org>2007-10-07 19:16:50 +0000
commit43230a52fe0ebd27ed996090ef18c7a6215bb66e (patch)
treeb17040a8d5500ec052da6de6e219a3c852a4065e
parent4cc204767c22c9b341bdade574f751289611ad13 (diff)
downloadportage-43230a52fe0ebd27ed996090ef18c7a6215bb66e.tar.gz
portage-43230a52fe0ebd27ed996090ef18c7a6215bb66e.tar.bz2
portage-43230a52fe0ebd27ed996090ef18c7a6215bb66e.zip
add standard --help/--version options
svn path=/main/trunk/; revision=7993
-rwxr-xr-xbin/etc-update26
1 files changed, 25 insertions, 1 deletions
diff --git a/bin/etc-update b/bin/etc-update
index d40400d19..73dfb6bf0 100755
--- a/bin/etc-update
+++ b/bin/etc-update
@@ -445,10 +445,34 @@ die() {
exit ${2}
}
+usage() {
+ cat <<-EOF
+ etc-update: Handle configuration file updates
+
+ Usage: etc-update [options]
+
+ Options:
+ -h, --help Show help and run away
+ -V, --version Show version and trundle away
+ EOF
+
+ [[ -n ${*:2} ]] && printf "\nError: %s\n" "${*:2}" 1>&2
+
+ exit ${1:-0}
+}
+
#
# Run the script
#
-scriptname=$(basename $0)
+
+while [[ -n $1 ]] ; do
+ case $1 in
+ -h|--help) usage;;
+ -V|--version) echo '$Id$'; exit 0;;
+ *) usage 1 "Invalid option '$1'";;
+ esac
+ shift
+done
type portageq > /dev/null || exit $?
eval $(portageq envvar -v CONFIG_PROTECT \