Use git-export use getopt to parse arguments

This commit is contained in:
Abhishek Mukherjee
2009-09-01 17:04:21 -04:00
parent 279e78ee1d
commit 0179df238a
+14 -6
View File
@@ -13,20 +13,28 @@ OPTIONS_SPEC=
force=0
destination=
while :
do
case $1 in
args=`getopt -o fh -l force,help,he,hel -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
eval set -- "$args"
while true ; do
case "$1" in
-f|--force)
force=1
shift
;;
-h|--h|--he|--hel|--help)
usage
shift
;;
--)
shift; break ;;
*)
break
echo "Invalid argument found!" >&2
exit 2;
;;
esac
shift
esac
done
if [ $# -ne 1 ]