From 9ddcd8fe726c9cca840016833c9024cffe72a4e7 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 27 Apr 2010 14:23:53 +0200 Subject: [PATCH] xbps-src: add -h flag to show usage. --HG-- extra : convert_revision : 51fbff55d296a3f818e736835a10763aff278f2d --- xbps-src/xbps-src.sh.in | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/xbps-src/xbps-src.sh.in b/xbps-src/xbps-src.sh.in index 13abeb13a88..633fdc8ccd0 100644 --- a/xbps-src/xbps-src.sh.in +++ b/xbps-src/xbps-src.sh.in @@ -38,7 +38,7 @@ trap "echo && exit 1" INT QUIT usage() { cat << _EOF -$progname: [-C] [-c ] [-m ] [-p ] +$progname: [-Ch] [-c ] [-m ] [-p ] Targets: build Build a package (fetch + extract + configure + build). @@ -67,13 +67,13 @@ Options: -C Do not remove build directory after successful installation. -c Path to global configuration file: if not specified @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf is used. + -h Usage output. -m Master directory, overwritting the value set in the configuration file at @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf. -p Package directory, overwritting default path at /pkg-binpkgs. _EOF - exit 1 } basename_cwd() @@ -135,10 +135,11 @@ check_config_vars() # # main() # -while getopts "Cc:m:p:" opt; do +while getopts "Cc:hm:p:" opt; do case $opt in C) export dontrm_builddir=yes;; c) config_file_specified=yes; XBPS_CONFIG_FILE="$OPTARG";; + h) usage && exit 0;; m) _MASTERDIR="$OPTARG" if [ ! -d ${_MASTERDIR} ]; then @@ -157,12 +158,12 @@ while getopts "Cc:m:p:" opt; do done shift $(($OPTIND - 1)) -[ $# -eq 0 -o $# -gt 2 ] && usage +[ $# -eq 0 -o $# -gt 2 ] && usage && exit 1 target="$1" if [ -z "$target" ]; then echo "=> ERROR: missing target." - usage + usage && exit 1 fi # @@ -312,7 +313,7 @@ unstow) ;; *) echo "=> ERROR: invalid target: $target." - usage + usage && exit 1 esac # Agur