[PATCH 2/4] pacdiff: Implement die()

Denton Liu liu.denton at gmail.com
Sat Dec 26 07:27:18 UTC 2020


In a future commit, we will be making more use of this function. For
now, implement it and use it in the one place where it's applicable.

Signed-off-by: Denton Liu <liu.denton at gmail.com>
---
 src/pacdiff.sh.in | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/pacdiff.sh.in b/src/pacdiff.sh.in
index c4dbd89..46a5adf 100644
--- a/src/pacdiff.sh.in
+++ b/src/pacdiff.sh.in
@@ -34,6 +34,11 @@ declare -i USE_FIND=0 USE_LOCATE=0 USE_PACDB=0 OUTPUTONLY=0
 # Import libmakepkg
 source "$LIBRARY"/util/message.sh
 
+die() {
+	error "$@"
+	exit 1
+}
+
 usage() {
 	cat <<EOF
 ${myname} v${myver}
@@ -127,8 +132,7 @@ else
 fi
 
 if ! type -p ${diffprog%% *} >/dev/null && (( ! OUTPUTONLY )); then
-	error "Cannot find the $diffprog binary required for viewing differences."
-	exit 1
+	die "Cannot find the $diffprog binary required for viewing differences."
 fi
 
 case $(( USE_FIND + USE_LOCATE + USE_PACDB )) in
-- 
2.29.2.889.g5298b911bd


More information about the pacman-contrib mailing list