summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2022-09-01 23:38:44 +0200
committerLevente Polyak <anthraxx@archlinux.org>2022-09-01 23:38:44 +0200
commitf8d2ad9a7dcd4a5345f53095d7d36c17cc8aa2fd (patch)
tree21ee745e0afc5450013afad77f3a1a6ec31cbc65
parent2e4060445a894cc91a7b4281ee5ae48cb4f210ab (diff)
downloaddevtools-f8d2ad9a7dcd4a5345f53095d7d36c17cc8aa2fd.tar.xz
diffpkg: pass the --color option appropriately to diffoscope
Diffoscope has a different option, called --text-color which only understands the verbose options. Hence we extend the --color shorthand for --color=auto and pass the changed option name to diffoscope.
-rw-r--r--src/diffpkg.in10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/diffpkg.in b/src/diffpkg.in
index b964d44..43af217 100644
--- a/src/diffpkg.in
+++ b/src/diffpkg.in
@@ -54,7 +54,7 @@ PKGINFO=0
BUILDINFO=0
DIFFMODE=--side-by-side
-DIFFCOLOR=--color
+DIFFCOLOR=--color=auto
DIFFWIDTH=--width=auto
DIFFOPTIONS=(--expand-tabs)
@@ -104,7 +104,11 @@ while (( $# )); do
shift 2
continue
fi
- DIFFCOLOR="$1"
+ if [[ $1 == --color ]]; then
+ DIFFCOLOR="--color=auto"
+ else
+ DIFFCOLOR="$1"
+ fi
shift
;;
-W|--width)
@@ -242,7 +246,7 @@ diff_pkgs() {
fi
if (( DIFFOSCOPE )); then
- diffoscope "$oldpkg" "$newpkg"
+ diffoscope "${DIFFCOLOR/--color/--text-color}" "$oldpkg" "$newpkg"
fi
}