From 5507ffd878eb620f7c12c04b24f4d4c3edc6f404 Mon Sep 17 00:00:00 2001
From: will Farrell <will.farrell@gmail.com>
Date: Sun, 12 Feb 2017 21:08:45 -0700
Subject: [PATCH] small bug fix

---
 README.md         |  4 ++--
 docker-entrypoint | 12 +++++-------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/README.md b/README.md
index 972bda6..f13a7f5 100644
--- a/README.md
+++ b/README.md
@@ -22,12 +22,12 @@ A great project, don't get me wrong. It was just missing certain key enterprise
 - Ability to trigger scripts in other containers on completion cron job using `trigger`.
 
 ## Config.json
-- `comment`: Comments to be included with crontab entry
+- `comment`: Comments to be included with crontab entry. Optional.
 - `schedule`: Crontab schedule syntax as described in https://godoc.org/github.com/robfig/cron. Ex `@hourly`, `@every 1h30m`, `* * * * * *`. Required.
 - `command`: Command to be run on docker container/image. Required.
 - `image`: Docker images name (ex `library/alpine:3.5`). Optional.
 - `project`: Docker Compose/Swarm project name. Optional, only applies when `contain` is included.
-- `container`: Full container name or container alias if `project` is set. Ignored if `image` is included.
+- `container`: Full container name or container alias if `project` is set. Ignored if `image` is included. Optional.
 - `dockerargs`: Command line docker `run`/`exec` arguments for full control. Defaults to ` `.
 - `trigger`: Array of docker-crontab subset objects. Subset includes: `image`,`project`,`container`,`command`,`dockerargs` 
 
diff --git a/docker-entrypoint b/docker-entrypoint
index a4c5a58..7829f8a 100755
--- a/docker-entrypoint
+++ b/docker-entrypoint
@@ -47,14 +47,12 @@ EOF
 }
 
 make_cmd() {
-    IMAGE=$(echo ${1} | jq -r .image)
-    CONTAINER=$(echo ${1} | jq -r .container)
-    if [ "${IMAGE}" != "null" ]; then
-        make_image_cmd
-    elif [ "${CONTAINER}" != "null" ]; then
-        make_container_cmd
+    if [ "$(echo ${1} | jq -r .image)" != "null" ]; then
+        make_image_cmd "$1"
+    elif [ "$(echo ${1} | jq -r .container)" != "null" ]; then
+        make_container_cmd "$1"
     else
-        echo "echo 'Error making docker command, image or container param missing.'"
+        echo ${1} | jq -r .command
     fi
 }