Improve build script options error reporting
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 17 Oct 2022 12:19:48 +0000 (14:19 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 17 Oct 2022 12:19:48 +0000 (14:19 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
build-image.sh

index d18125af7b50d1c3adbd5d5625ef50919370af53..14efb6a7a0f0541ec4b6706e4c246c6cf0f2fd4d 100755 (executable)
@@ -22,10 +22,20 @@ while getopts "n:h" option; do
       elif [[ -z "${images##*$name*}" ]]; then
         make NAME=${name}
       else
+        echo "Error: Unknown image name for option argument -${OPTARG}" >&2;
         usage
         exit 1
       fi
       ;;
+    \?)
+      # Invalid option
+      echo "Error: Unknown or invalid option argument for -${OPTARG}" >&2;
+      usage
+      exit 1;;
+    :)
+      echo "Error: Missing option argument for -${OPTARG}" >&2;
+      usage
+      exit 1;;
     *|h)
       usage
       ;;