diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2014-08-13 18:54:08 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2014-08-13 18:54:08 +0200 |
commit | 3fe886613dd2d8ba1f8241ccfcf7a1f447d418ae (patch) | |
tree | 35d93f6ae7f057fe47c1602069f111422d3736e3 /xdiff | |
parent | edcb1d4c1c47493f90f600cd867b7077bec3124b (diff) | |
download | xtools-3fe886613dd2d8ba1f8241ccfcf7a1f447d418ae.tar.gz xtools-3fe886613dd2d8ba1f8241ccfcf7a1f447d418ae.tar.xz xtools-3fe886613dd2d8ba1f8241ccfcf7a1f447d418ae.zip |
xdiff: -u for plain diff -u
Diffstat (limited to 'xdiff')
-rwxr-xr-x | xdiff | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/xdiff b/xdiff index e6c7cdb..406e24f 100755 --- a/xdiff +++ b/xdiff @@ -1,9 +1,19 @@ #!/bin/sh -# xdiff [DIR] - merge XBPS .new-* files +# xdiff [-u] [DIR] - merge XBPS .new-* files + +mergeutil() { + vimdiff "$1" "$2" && rm -vi "$1" +} + +if [ "$1" = -u ]; then + shift + DIFF="diff -u" +else + DIFF=mergeutil +fi DIR=${1:-/etc} for newfile in $(find "$DIR" -name '*.new-*_*'); do - vimdiff "${newfile}" "${newfile%.new-*_*}" && - rm -vi "${newfile}" + $DIFF "$newfile" "${newfile%.new-*_*}" done |