changeset 48:dfcbe14615b0

Refactor: replace an "if" by "case". This allows for easier maintainance of further "short" specials.
author Franz Glasner <hg@dom66.de>
date Wed, 22 Nov 2017 21:32:47 +0100
parents 0905457fb45b
children ffa6a61e77e8
files bin/check-ports
diffstat 1 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/bin/check-ports	Wed Nov 22 09:36:13 2017 +0100
+++ b/bin/check-ports	Wed Nov 22 21:32:47 2017 +0100
@@ -185,9 +185,26 @@
             # NOTE: -s and -A/-a are incompatible: so "alldata_XXX" needs not
             #       to be checked!
             #
-            if [ "${repository}" != "${FREEBSD_REPO}" -o "${llabel}" != '<' -o "${remote_FreeBSD_label}" != '=' -o "${remote_LocalRepo_label}" != '?' -o "${remote_LocalBSDPorts_label}" != '?' ]; then
-                _print_detail=1
-            fi
+	    case "${repository}" in
+		"${FREEBSD_REPO}")
+		    if [ "${llabel}" != '<' -o "${remote_FreeBSD_label}" != '=' -o "${remote_LocalRepo_label}" != '?' -o "${remote_LocalBSDPorts_label}" != '?' ]; then
+			_print_detail=1
+		    fi
+		    ;;
+		"${LOCAL_REPO}")
+		    _print_detail=1
+		    ;;
+		"${LOCALBSDPORTS_REPO}")
+		    _print_detail=1
+		    ;;
+		"${PORTS_DIRECT_INSTALLED_REPO}")
+		    _print_detail=1
+		    ;;
+		*)
+		    echo "ERROR: unhandled repository: ${repository}" <&2
+		    exit 1
+		    ;;
+	    esac
         else
             _print_detail=1
         fi