[projects/cleanbuild] Refactor: Add is_bool helper

glen glen at pld-linux.org
Wed Feb 22 20:08:33 CET 2023


commit defb816c0b1804fbe4efad7bfbecfab6fd90db13
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Wed Feb 22 21:07:59 2023 +0200

    Refactor: Add is_bool helper

 bin/cleanbuild-docker.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/bin/cleanbuild-docker.sh b/bin/cleanbuild-docker.sh
index 40ed415..cd6641f 100755
--- a/bin/cleanbuild-docker.sh
+++ b/bin/cleanbuild-docker.sh
@@ -46,6 +46,10 @@ is_no() {
 	esac
 }
 
+is_bool() {
+	[ "$1" = "true" -o "$1" = "false" ] || die "Invalid boolean value: $1"
+}
+
 tmpfs() {
 	if is_no "${TMPFS:-true}" || [ "$TMPFS" = "0" ]; then
 		return
@@ -209,7 +213,7 @@ parse_options() {
 			;;
 		--keep-container)
 			shift
-			[ "$1" = "true" -o "$1" = "false" ] || die "Invalid boolean value: $1"
+			is_bool "$1"
 			KEEP_CONTAINER=$1
 			;;
 		--with)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/cleanbuild.git/commitdiff/defb816c0b1804fbe4efad7bfbecfab6fd90db13



More information about the pld-cvs-commit mailing list