Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 29 additions & 9 deletions dockerc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ while true; do
break
fi

# Parse context optional positional argument
# Parse first optional positional argument

if [ "$1" = '?' ]; then
# Print context help
Expand All @@ -103,6 +103,7 @@ while true; do
break
fi

# Parse docker command preset
if [ "$(echo "$1" | cut -c1)" = '@' ]; then
if [ "$1" = '@' ]; then
# Print docker preset help
Expand All @@ -113,6 +114,13 @@ while true; do

DOCKERC_DOCKER_PRESET="$1"
shift

# Parse update install tag argument
elif [ "$DOCKERC_UPDATE" = 'true' ]; then
DOCKERC_INSTALL_TAG="$1"
shift

# Parse context argument
else
DOCKERC_CONTEXT="$1"
shift
Expand All @@ -124,7 +132,9 @@ while true; do
break
fi

# Parse docker command preset optional positional argument
# Parse second optional positional argument

# Parse docker command preset
if
[ -z "$DOCKERC_DOCKER_PRESET" ] &&
(
Expand All @@ -151,7 +161,8 @@ while true; do
# Else, this is a command argument
fi

# Parse command args optional positional arguments
# Parse trailing positional arguments
# Parse command args
DOCKERC_COMMAND_ARGS=''
for ARG in "$@"; do

Expand Down Expand Up @@ -226,6 +237,19 @@ if [ -n "$DOCKERC_INSTALL_DIR" ]; then
INSTALL_DIR="$DOCKERC_INSTALL_DIR"
fi

INSTALL_TAG=''
if [ -n "$DOCKERC_INSTALL_TAG" ]; then
# Use from argument or environment variable
if
[ "$DOCKERC_INSTALL_TAG" = 'HEAD' ] || [ "$DOCKERC_INSTALL_TAG" = 'head' ] ||
[ "$DOCKERC_INSTALL_TAG" = '.' ] || [ "$DOCKERC_INSTALL_TAG" = '-' ]
then
INSTALL_TAG='HEAD'
else
INSTALL_TAG="$DOCKERC_INSTALL_TAG"
fi
fi

DOCKER_PRESET=''
if [ -n "$DOCKERC_DOCKER_PRESET" ]; then
# Use from argument or environment variable
Expand Down Expand Up @@ -509,13 +533,9 @@ if [ "$UPDATE" = 'true' ]; then
exit 1
fi

# Read install tag from first positional argument: context
if [ -z "$CONTEXT" ]; then
if [ -z "$INSTALL_TAG" ]; then
# Default install tag is latest released version
INSTALL_TAG="$(get_latest_version)"
elif [ "$CONTEXT" = 'HEAD' ] || [ "$CONTEXT" = 'head' ] || [ "$CONTEXT" = '.' ] || [ "$CONTEXT" = '-' ]; then
INSTALL_TAG='HEAD'
else
INSTALL_TAG="$CONTEXT"
fi

if [ "$QUIET" = 'false' ]; then
Expand Down