Change a few minor nits in bashbrew.sh

This commit is contained in:
Tianon Gravi 2014-12-16 17:54:45 -07:00
parent eb530e9b79
commit ecdc95f4c9
1 changed files with 21 additions and 24 deletions

View File

@ -23,13 +23,13 @@ usage: $0 [build|push] [options] [repo[:tag] ...]
ie: $0 build --all ie: $0 build --all
$0 push debian ubuntu:12.04 $0 push debian ubuntu:12.04
This script builds or pushes the Docker images specified using the Git This script processes the specified Docker images using the corresponding
repositories specified in the library files in the namespaces. repository manifest files.
common options: common options:
--all Builds all Docker repos specified in library --all Build all repositories specified in library
--docker="$docker" --docker="$docker"
Use a custom Docker binary. Use a custom Docker binary
--help, -h, -? Print this help message --help, -h, -? Print this help message
--library="$library" --library="$library"
Where to find repository manifest files Where to find repository manifest files
@ -40,19 +40,19 @@ common options:
building building
build options: build options:
--no-build Don't build, just echo what would have built --no-build Don't build, print what would build
--no-clone Don't pull the Git repos --no-clone Don't pull/clone Git repositories
--src="$src" --src="$src"
Where to store the cloned Git repositories Where to store cloned Git repositories (GOPATH style)
push options: push options:
--no-push Don't actually push the images to the Docker Hub --no-push Don't push, print what would push
EOUSAGE EOUSAGE
} }
# which subcommand # which subcommand
subcommand=$1 subcommand="$1"
case "$subcommand" in case "$subcommand" in
build|push) build|push)
shift shift
@ -67,7 +67,7 @@ case "$subcommand" in
esac esac
# arg handling # arg handling
opts="$(getopt -o 'h?' --long 'help,all,no-clone,no-build,no-push,library:,src:,logs:,namespaces:,docker:' -- "$@" || { usage >&2 && false; })" opts="$(getopt -o 'h?' --long 'all,docker:,help,library:,logs:,namespaces:,no-build,no-clone,no-push,src:' -- "$@" || { usage >&2 && false; })"
eval set -- "$opts" eval set -- "$opts"
doClone=1 doClone=1
@ -78,22 +78,17 @@ while true; do
flag=$1 flag=$1
shift shift
case "$flag" in case "$flag" in
--help|-h|'-?')
usage
exit 0
;;
--all) buildAll=1 ;; --all) buildAll=1 ;;
--no-clone) doClone= ;; --docker) docker="$1" && shift ;;
--no-build) doBuild= ;; --help|-h|'-?') usage && exit 0 ;;
--no-push) doPush= ;;
--library) library="$1" && shift ;; --library) library="$1" && shift ;;
--src) src="$1" && shift ;;
--logs) logs="$1" && shift ;; --logs) logs="$1" && shift ;;
--namespaces) namespaces="$1" && shift ;; --namespaces) namespaces="$1" && shift ;;
--docker) docker="$1" && shift ;; --no-build) doBuild= ;;
--) --no-clone) doClone= ;;
break --no-push) doPush= ;;
;; --src) src="$1" && shift ;;
--) break ;;
*) *)
{ {
echo "error: unknown flag: $flag" echo "error: unknown flag: $flag"
@ -113,8 +108,10 @@ repos+=( "$@" )
repos=( "${repos[@]%/}" ) repos=( "${repos[@]%/}" )
if [ "${#repos[@]}" -eq 0 ]; then if [ "${#repos[@]}" -eq 0 ]; then
echo >&2 'error: no repos specified' {
usage >&2 echo 'error: no repos specified'
usage
} >&2
exit 1 exit 1
fi fi