dotfiles/.local/bin/scripts/dif

9 lines
536 B
Text
Raw Normal View History

2022-07-06 11:14:31 +02:00
#!/bin/bash -e
2021-07-29 16:02:20 +02:00
# interactive diff with pagination and nice coloring
2022-08-04 23:53:53 +02:00
# TODO diff sqlite repos
2022-07-06 11:14:31 +02:00
if file --brief --mime "$1" "$2" | grep --quiet audio
2022-05-11 13:18:27 +02:00
then ff() { ffprobe -loglevel warning -print_format default=noprint_wrappers=1 -show_format -pretty "$@"; }
2022-06-13 15:49:14 +02:00
$(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")
else diff-color --report-identical-files "$@"
2022-05-11 12:18:47 +02:00
fi | less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen