dotfiles/.local/bin/scripts/dif

8 lines
448 B
Plaintext
Raw Normal View History

#!/bin/sh
2021-07-29 14:02:20 +00:00
# interactive diff with pagination and nice coloring
2022-05-11 10:18:47 +00:00
if file --mime "$1" "$2" | grep --quiet audio
2022-05-11 11:18:27 +00:00
then 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") --label="$1" --label="$2" <(ff "$1") <(ff "$2")
2022-05-11 10:18:47 +00:00
else diff-color "$@"
fi | less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen