packages: adapter - use $PAGER for screen paging (defaults to less -r) - ad...

sparky sparky at pld-linux.org
Tue Dec 1 11:04:58 CET 2009


Author: sparky                       Date: Tue Dec  1 10:04:58 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- use $PAGER for screen paging (defaults to less -r)
- added ~/.adapterrc support

---- Files affected:
packages:
   adapter (1.41 -> 1.42) 

---- Diffs:

================================================================
Index: packages/adapter
diff -u packages/adapter:1.41 packages/adapter:1.42
--- packages/adapter:1.41	Tue Dec  1 03:52:19 2009
+++ packages/adapter	Tue Dec  1 11:04:53 2009
@@ -47,6 +47,18 @@
 	exit 1
 fi
 
+[ -n "$PAGER" ] || PAGER="/usr/bin/less -r"
+
+if [ -n "$CONFIG_DIR" ]; then
+	USER_CFG="$CONFIG_DIR/.adapterrc"
+elif [ -n "$HOME_ETC" ]; then
+	USER_CFG="$HOME_ETC/.adapterrc"
+else
+	USER_CFG=~/.adapterrc
+fi
+
+[ -f $USER_CFG ] && . $USER_CFG
+
 t=$(getopt -o hsomdaV --long help,version,sort,sort-br,no-macros,skip-macros,skip-desc,skip-defattr -n "$PROGRAM" -- "$@") || exit $?
 eval set -- "$t"
 
@@ -104,17 +116,6 @@
 	 ' "$@"
 }
 
-showdiff()
-{
-	l=$(cat $1 | wc -l)
-	eval $(resize) # get terminal size
-	if [ $l -gt $LINES ]; then
-		diffcol $1 | less -r
-	else
-		diffcol $1
-	fi
-}
-
 diff2hunks()
 {
 	 # diff2hunks orignally by dig
@@ -233,7 +234,7 @@
 	elif [ "$(diff --brief $SPECFILE $tmp)" ]; then
 		diff -u $SPECFILE $tmp > $tmp.diff
 		if [ -t 1 ]; then
-				showdiff $tmp.diff
+				diffcol $tmp.diff | $PAGER
 				while : ; do
 					echo -n "Accept? (Yes, No, Confirm each chunk)? "
 					read ans
@@ -246,7 +247,7 @@
 					[cC]) # confirm each chunk
 						diff2hunks $tmp.diff
 						for t in $(ls $tmp-*.diff); do
-								showdiff $t
+								diffcol $t | $PAGER
 								echo -n "Accept? (Yes, [N]o, Quit)? "
 								read ans
 								case "$ans" in
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/adapter?r1=1.41&r2=1.42&f=u



More information about the pld-cvs-commit mailing list