dotfiles/.local/bin/scripts/dif

7 lines
411 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
then $(test $(tput cols) -gt 120 && echo "diff --color=always --side-by-side" || echo "diff-color") --label="$1" --label="$2" <(ffprobe -hide_banner "$1" 2>&1 | tail +2) <(ffprobe -hide_banner "$2" 2>&1 | tail +2 )
else diff-color "$@"
fi | less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen