commitpkg: use getopts to parse options

Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
This commit is contained in:
Dave Reisner 2011-08-16 21:35:57 -04:00 committed by Pierre Schmitz
parent ba4f28cc43
commit e652dc8085
1 changed files with 11 additions and 9 deletions

View File

@ -98,15 +98,17 @@ done
# see if any limit options were passed, we'll send them to rsync # see if any limit options were passed, we'll send them to rsync
rsyncopts=(-e ssh -p --chmod=ug=rw,o=r -c -h -L --progress --partial -y) rsyncopts=(-e ssh -p --chmod=ug=rw,o=r -c -h -L --progress --partial -y)
if [ "$1" = '-l' ]; then while getopts ':l:a:' flag; do
rsyncopts+=("--bwlimit=$2") case $flag in
shift 2 l) rsyncopts+=("--bwlimit=$2") ;;
fi a) commit_arch=$2 ;;
:) echo "option requires an argument -- '$OPTARG'" >&2
if [ "$1" = "-a" ]; then exit 1 ;;
commit_arch=$2 \?) echo "invalid option -- '$OPTARG'" >&2
shift 2 exit 1 ;;
fi esac
done
shift $(( OPTIND - 1 ))
if [ -n "$(svn status -q)" ]; then if [ -n "$(svn status -q)" ]; then
echo -n 'committing changes to trunk...' echo -n 'committing changes to trunk...'