From 4c26768374948637471c65ec8cf604da4c358ddb Mon Sep 17 00:00:00 2001 From: mag37 Date: Fri, 2 Feb 2024 20:52:01 +0100 Subject: [PATCH] Added -v option, prints version --- dockcheck.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dockcheck.sh b/dockcheck.sh index f39bfce..c2d2688 100755 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -31,8 +31,9 @@ Help() { echo "-m Monochrome mode, no printf color codes." echo "-n No updates, only checking availability." echo "-p Auto-Prune dangling images after update." - echo "-r Allow updating images for docker run, wont update the container" - echo "-s Include stopped containers in the check. (Logic: docker ps -a)" + echo "-r Allow updating images for docker run, wont update the container." + echo "-s Include stopped containers in the check. (Logic: docker ps -a)." + echo "-v Prints current version." } ### Colors: @@ -44,7 +45,7 @@ c_teal="\033[0;36m" c_reset="\033[0m" Stopped="" -while getopts "aynpfrhlisme:d:" options; do +while getopts "aynpfrhlisvme:d:" options; do case "${options}" in a|y) AutoUp="yes" ;; n) AutoUp="no" ;; @@ -56,6 +57,7 @@ while getopts "aynpfrhlisme:d:" options; do e) Exclude=${OPTARG} ;; m) declare c_{red,green,yellow,blue,teal,reset}="" ;; s) Stopped="-a" ;; + v) printf "%s\n" "$VERSION" ; exit 0 ;; d) DaysOld=${OPTARG} if ! [[ $DaysOld =~ ^[0-9]+$ ]] ; then { printf "Days -d argument given (%s) is not a number.\n" "${DaysOld}" ; exit 2 ; } ; fi ;; h|*) Help ; exit 2 ;;