2022-10-02 20:44:22 +00:00
|
|
|
#!/bin/bash -ex
|
2021-07-29 14:02:20 +00:00
|
|
|
# interactive diff with pagination and nice coloring
|
2022-09-16 12:48:43 +00:00
|
|
|
# TODO diff sqlite repos with sqldiff
|
2022-09-30 18:01:37 +00:00
|
|
|
mime="$(file --brief --mime "$1" "$2")"
|
|
|
|
case "$mime" in
|
|
|
|
(*audio*)
|
|
|
|
ff() { ffprobe -loglevel warning -print_format default=noprint_wrappers=1 -show_format -pretty "$@"; }
|
|
|
|
$(test $(tput cols) -gt 120 && echo "diff --color=always --side-by-side" || echo "diff-color") \
|
|
|
|
--report-identical-files --label="$1" --label="$2" <(ff "$1") <(ff "$2")
|
|
|
|
;;
|
|
|
|
(*sqlite*) sqldiff "$@" ;;
|
2022-10-13 19:57:22 +00:00
|
|
|
(text/*)
|
|
|
|
# Use wiked-diff only for text <10MB
|
|
|
|
if test 10000000 -gt "$(stat --format=%s *.geojson | paste -s -d'+' | bc)"
|
2022-10-02 20:44:22 +00:00
|
|
|
then wiked-diff "$@"
|
2022-10-13 19:57:22 +00:00
|
|
|
else diff --color=always --unified=1 --report-identical-files "$@"
|
2022-10-02 20:44:22 +00:00
|
|
|
fi;;
|
2022-10-13 19:57:22 +00:00
|
|
|
(*) diff-color --report-identical-files "$@";;
|
2022-09-30 18:01:37 +00:00
|
|
|
esac | less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen
|