Fix some minor issues in bashbrew.sh

Double quotes and indented heredocs!
This commit is contained in:
Tianon Gravi 2015-02-13 17:14:12 -07:00
parent fafcbfa3f5
commit 24590577c9
1 changed files with 44 additions and 45 deletions

View File

@ -19,47 +19,47 @@ logs="$(readlink -f "$logs")"
self="$(basename "$0")" self="$(basename "$0")"
usage() { usage() {
cat <<EOUSAGE cat <<-EOUSAGE
usage: $self [build|push|list] [options] [repo[:tag] ...] usage: $self [build|push|list] [options] [repo[:tag] ...]
ie: $self build --all ie: $self build --all
$self push debian ubuntu:12.04 $self push debian ubuntu:12.04
$self list --namespaces='_' debian:7 hello-world $self list --namespaces='_' debian:7 hello-world
This script processes the specified Docker images using the corresponding This script processes the specified Docker images using the corresponding
repository manifest files. repository manifest files.
common options: common options:
--all Build all repositories 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
--logs="$logs" --logs="$logs"
Where to store the build logs Where to store the build logs
--namespaces="$namespaces" --namespaces="$namespaces"
Space separated list of image namespaces to act upon Space separated list of image namespaces to act upon
Note that "_" is a special case here for the unprefixed Note that "_" is a special case here for the unprefixed
namespace (ie, "debian" vs "library/debian"), and as such namespace (ie, "debian" vs "library/debian"), and as such
will be implicitly ignored by the "push" subcommand will be implicitly ignored by the "push" subcommand
Also note that "build" will always tag to the unprefixed Also note that "build" will always tag to the unprefixed
namespace because it is necessary to do so for dependent namespace because it is necessary to do so for dependent
images to use FROM correctly (think "onbuild" variants that images to use FROM correctly (think "onbuild" variants that
are "FROM base-image:some-version") are "FROM base-image:some-version")
build options: build options:
--no-build Don't build, print what would build --no-build Don't build, print what would build
--no-clone Don't pull/clone Git repositories --no-clone Don't pull/clone Git repositories
--src="$src" --src="$src"
Where to store cloned Git repositories (GOPATH style) Where to store cloned Git repositories (GOPATH style)
push options: push options:
--no-push Don't push, print what would push --no-push Don't push, print what would push
EOUSAGE EOUSAGE
} }
# arg handling # arg handling
@ -71,7 +71,7 @@ doBuild=1
doPush=1 doPush=1
buildAll= buildAll=
while true; do while true; do
flag=$1 flag="$1"
shift shift
case "$flag" in case "$flag" in
--all) buildAll=1 ;; --all) buildAll=1 ;;
@ -97,10 +97,9 @@ done
# which subcommand # which subcommand
subcommand="$1" subcommand="$1"
shift || { usage >&2 && exit 1; }
case "$subcommand" in case "$subcommand" in
build|push|list) build|push|list) ;;
shift
;;
*) *)
{ {
echo "error: unknown subcommand: $1" echo "error: unknown subcommand: $1"