From cc2956051fb9b5f1451c0068d94ab881eb44177e Mon Sep 17 00:00:00 2001 From: Ryan Daniels <513609+ryandaniels@users.noreply.github.com> Date: Wed, 14 Sep 2022 22:55:43 -0400 Subject: [PATCH] update help message with another example --- README.md | 4 +++- docker_image_find_tag.sh | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d2431f4..43b79c3 100644 --- a/README.md +++ b/README.md @@ -68,12 +68,14 @@ If you are unlucky, continue on.. ## Usage +The Docker image name (-n) must match the name (REPOSITORY) from "docker images". For example "traefik" (which is an "Official" image), or "portainer/portainer". + ```bash ./docker_image_find_tag.sh -h Usage: ./docker_image_find_tag.sh [-n image name] [-i image-id] Example: ./docker_image_find_tag.sh -n traefik -i 96c63a7d3e50 -f 1.7 - -n [text]: Image name (Required). '-n traefik' would reference the traefik image + -n [text]: Image name (Required). '-n traefik' would reference the traefik image or '-n portainer/portainer' for portainer -i [text]: Image ID. Required if Image ID (Long) (-L) is ommited. Found in 'docker images'. Can also use -i image:tag -L [text]: Image ID (Long). Required if Image ID (-i) is ommited diff --git a/docker_image_find_tag.sh b/docker_image_find_tag.sh index 40b08a6..f8dcbaa 100755 --- a/docker_image_find_tag.sh +++ b/docker_image_find_tag.sh @@ -32,7 +32,7 @@ show_help () { echo "Usage:" echo "$0 [-n image name] [-i image-id]" echo "Example: $0 -n traefik -i 96c63a7d3e50 -f 1.7" - echo " -n [text]: Image name (Required). '-n traefik' would reference the traefik image" + echo " -n [text]: Image name (Required). '-n traefik' would reference the traefik image or '-n portainer/portainer' for portainer" echo " -i [text]: Image ID. Required if Image ID (Long) (-L) is ommited." echo " Found in 'docker images'. Can also use -i image:tag" echo " -L [text]: Image ID (Long). Required if Image ID (-i) is ommited" @@ -88,6 +88,7 @@ shift $((OPTIND-1)) if [ -z "$IMAGE_NAME" ]; then echo "Requires Image Name" + show_help exit 1; else if [[ "$VERBOSE" -eq 1 ]]; then @@ -102,6 +103,7 @@ fi if [ -z "$IMAGE_ID_SHORT" ] && [ -z "$IMAGE_ID_LONG" ]; then echo "Requires Image ID or Image ID (Long)" + show_help exit 1; fi @@ -116,6 +118,7 @@ if [ -z "$IMAGE_ID_LONG" ]; then # Make sure IMAGE_ID_LONG has value (should never happen) if [ -z "$IMAGE_ID_LONG" ]; then echo "Error: Id of $IMAGE_ID_SHORT is empty" + show_help exit 1; fi # podman (tested on v1.7.0 & 1.8.0) omits sha256: from beginning of Id, fix: