20 lines
815 B
Bash
Executable File
20 lines
815 B
Bash
Executable File
#!/bin/bash -ex
|
|
# interactive diff with pagination and nice coloring
|
|
# TODO diff sqlite repos with sqldiff
|
|
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 "$@" ;;
|
|
(text/*)
|
|
# Use wiked-diff only for text <10MB
|
|
if test 10000000 -gt "$(stat --format=%s *.geojson | paste -s -d'+' | bc)"
|
|
then wiked-diff "$@"
|
|
else diff --color=always --unified=1 --report-identical-files "$@"
|
|
fi;;
|
|
(*) diff-color --report-identical-files "$@";;
|
|
esac | less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen
|