diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-10-12 06:04:05 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-10-12 06:04:05 +0000 |
commit | 23f1e0106d362b0f087f03a10095499e50103387 (patch) | |
tree | 6ce9cb6dd97a4b44c04aba2a478f56a76494029d | |
parent | 6cb1248470027cab662e0229841c0d52657c07c1 (diff) | |
download | portage-23f1e0106d362b0f087f03a10095499e50103387.tar.gz portage-23f1e0106d362b0f087f03a10095499e50103387.tar.bz2 portage-23f1e0106d362b0f087f03a10095499e50103387.zip |
add standard --help/--version options (trunk r7993)
svn path=/main/branches/2.1.2/; revision=8063
-rwxr-xr-x | bin/etc-update | 26 |
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 \ |