packages: adapter - use less only if terminal is to short
sparky
sparky at pld-linux.org
Tue Dec 1 03:39:48 CET 2009
Author: sparky Date: Tue Dec 1 02:39:48 2009 GMT
Module: packages Tag: HEAD
---- Log message:
- use less only if terminal is to short
---- Files affected:
packages:
adapter (1.39 -> 1.40)
---- Diffs:
================================================================
Index: packages/adapter
diff -u packages/adapter:1.39 packages/adapter:1.40
--- packages/adapter:1.39 Sun Jun 28 19:03:53 2009
+++ packages/adapter Tue Dec 1 03:39:43 2009
@@ -104,6 +104,17 @@
' "$@"
}
+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
@@ -222,7 +233,7 @@
elif [ "$(diff --brief $SPECFILE $tmp)" ]; then
diff -u $SPECFILE $tmp > $tmp.diff
if [ -t 1 ]; then
- diffcol $tmp.diff | less -r
+ showdiff $tmp.diff
while : ; do
echo -n "Accept? (Yes, No, Confirm each chunk)? "
read ans
@@ -235,7 +246,7 @@
[cC]) # confirm each chunk
diff2hunks $tmp.diff
for t in $(ls $tmp-*.diff); do
- diffcol $t | less -r
+ showdiff $t
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.39&r2=1.40&f=u
More information about the pld-cvs-commit
mailing list