Commit 5fc2f148 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Improve add-auth usage message

parent ce83fde4
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
#!/bin/sh
set -eu

die() { echo "$USAGE"; echo "Fatal: $*"; exit 1; }
trap 'test $? -eq 2 && echo >&2 "$USAGE"' EXIT

USAGE="$0 REPOSITORY USERNAME
USAGE="
Usage: $0 REPOSITORY USERNAME

REPOSITORY  The image repository to authenticate against
USERNAME    The username to authenticate with
@@ -11,9 +12,9 @@ USERNAME The username to authenticate with
The password to authenticate with will be read from STDIN
"

CONFIG=$DOCKER_CONFIG/config.json || die "DOCKER_CONFIG must be set in the environment"
REPOSITORY=$1 || die "REPOSITORY is missing"
USERNAME=$2 || die "USERNAME is missing"
CONFIG=$DOCKER_CONFIG/config.json
REPOSITORY=${1?"REPOSITORY is missing"}
USERNAME=${2?"USERNAME is missing"}

read -p "Enter password: " PASSWORD