[2/4] pacdiff: Implement die()

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

Commit Message

Denton Liu Dec. 26, 2020, 7:27 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