[v2,1/3] pacdiff: Implement die()

Message ID 4ddc2db0d4d19c414452067c51ca6a34136f519c.1614858901.git.liu.denton@gmail.com
State New
Headers show
Series pacdiff: learn (M)erge mode | expand

Commit Message

Denton Liu March 4, 2021, 11:55 a.m. UTC
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@gmail.com>
---
 src/pacdiff.sh.in | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Patch

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