scripts/git-get: Format usage()

master
Pierre Neidhardt 2015-09-22 14:00:27 +02:00
parent 83c83587e7
commit 04b79f9b14
1 changed files with 9 additions and 8 deletions

View File

@ -1,33 +1,34 @@
#!/bin/sh #!/bin/sh
_usage () { DOMAIN=bitbucket.org
USER=ambrevar
usage() {
cat<<EOF cat<<EOF
Usage: ${1##*/} [OPTIONS] REPOS Usage: ${1##*/} [OPTIONS] REPOS
Clone multiple git repos from \$DOMAIN:\$USER. Clone git repo(s) from $DOMAIN:$USER.
Options: Options:
-h: Show this help. -h: Show this help.
-d DOMAIN: Set domain. -d DOMAIN: Set domain.
-u USER: Set the repository owner. -u USER: Set repository owner.
EOF EOF
} }
DOMAIN=bitbucket.org
USER=ambrevar
while getopts ":hd:u:" opt; do while getopts ":hd:u:" opt; do
case $opt in case $opt in
h) h)
_usage "$0" usage "$0"
exit 1 ;; exit 1 ;;
d) d)
DOMAIN=$OPTARG ;; DOMAIN=$OPTARG ;;
u) u)
USER=$OPTARG ;; USER=$OPTARG ;;
\?) \?)
_usage "$0" usage "$0"
exit 1 ;; exit 1 ;;
esac esac
done done
@ -35,7 +36,7 @@ done
shift $(($OPTIND - 1)) shift $(($OPTIND - 1))
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
_usage "$0" usage "$0"
exit 1 exit 1
fi fi