Mail archive
alpine-devel

[alpine-devel] [PATCH 4/4] update-conf: add vimdiff action

From: Dubiousjim <dubiousjim_at_gmail.com>
Date: Mon, 1 Jul 2013 17:14:17 -0400

---
 update-conf.in | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/update-conf.in b/update-conf.in
index da4208c..90c7e69 100644
--- a/update-conf.in
+++ b/update-conf.in
_at_@ -51,6 +51,11 @@ while true; do
 	shift
 done
 
+if which vimdiff >/dev/null; then
+	vflag=", Vimdiff old new"
+	vflag2="/v"
+fi
+
 for apknew in $(find "$ROOT/etc" -name '*.apk-new') ; do
 	p="${apknew%.apk-new}"
 	f="${p#${ROOT}/}"
_at_@ -75,7 +80,7 @@ for apknew in $(find "$ROOT/etc" -name '*.apk-new') ; do
 		# ask user what to do with the file
 		while [ -z "$choice" ] ; do
 			echo "New $p available:"
-			echon "Quit, Next, Show diff, Edit new, Zap new, Use new (q/n/s/e/z/u) [s]: "
+			echon "Quit, Next, Show diff, Edit new${vflag}, Zap new, Use new (q/n/s/e${vflag2}/z/u) [s]: "
 			default_read choice "s" </dev/tty
 			case "$choice" in
 				q) exit;;
_at_@ -84,6 +89,10 @@ for apknew in $(find "$ROOT/etc" -name '*.apk-new') ; do
 				   unset choice
 				   ;;	
 				e) ${EDITOR:-vi} "$apknew" ; unset choice;;
+				v) if [ "$vflag" ]; then
+					vimdiff "$p" "$apknew"
+				   fi
+				   unset choice;;
 				z) rm "$apknew";;
 				u) mv "$apknew" "$p";;
 				*) unset choice;;
-- 
1.8.3.1
---
Unsubscribe:  alpine-devel+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-devel+help_at_lists.alpinelinux.org
---
Received on Mon Jul 01 2013 - 17:14:17 UTC