]> git.pld-linux.org Git - packages/rpm-build-tools.git/commitdiff
- use $PAGER for screen paging (defaults to less -r)
authorsparky <sparky@pld-linux.org>
Tue, 1 Dec 2009 10:04:53 +0000 (10:04 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
- added ~/.adapterrc support

Changed files:
    adapter.sh -> 1.42

adapter.sh

index cb698ab3ebb0e9573e32deba3a4f39a0bc043843..a1ef26a470ad60211f7b4be9bf483734768eb887 100644 (file)
@@ -47,6 +47,18 @@ if [ ! -x /usr/bin/patch ]; then
        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 @@ diffcol()
         ' "$@"
 }
 
-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 @@ adapterize() {
        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 @@ adapterize() {
                                        [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
This page took 0.033597 seconds and 4 git commands to generate.