bin: improve diffs

This commit is contained in:
xeruf 2022-05-11 12:18:47 +02:00
parent b6865fb802
commit 3e5da69b16
4 changed files with 7 additions and 4 deletions

View File

@ -379,6 +379,7 @@ alias rcs='rsync --recursive --info=progress2,remove,symsafe,flist,del --human-r
alias dsync='rc --delete --specials'
alias move='rc --remove-source-files'
alias rdiff='rsync --recursive --progress --delete --links --dry-run'
alias rdiffe='rdiff --existing --size-only'
# Swap the names of two files
swap() {

View File

@ -1,4 +1,6 @@
#!/bin/sh
# interactive diff with pagination and nice coloring
diff-color --report-identical-files "$@" |
less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen
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

View File

@ -1,4 +1,4 @@
#!/bin/sh
# Colorize with diffr
diff --color=always --unified=2 "$@" |
diff --color=always --report-identical-files --unified=2 "$@" |
diffr --colors refine-added:none:background:0x33,0x66,0x33:bold --colors added:none:background:0x33,0x44,0x33 --colors refine-removed:none:background:0x66,0x33,0x33:bold --colors removed:none:background:0x44,0x33,0x33

View File

@ -10,7 +10,7 @@ case $1 in
# need to install zsh-doc package for info pages
info --vi-keys $(test "$last" != zsh && echo "--index-search=$last") zsh ||
LESS="$LESS +/^ *$last *\\[" man zshall;;
(gh|chordpro|bat|pdfjam|reflector|topgrade|r128gain|7z|kubectl) unbuffer "$@" --help | $paginate;;
(gh|chordpro|bat|pdfjam|reflector|topgrade|r128gain|7z|kubectl|diffr) unbuffer "$@" --help | $paginate;;
(caddy|stretchly|go|fossil) "$1" help "${@:2}" | $paginate;;
(rails) { rails -H && rails --help; } | $paginate;;
(plantuml) unbuffer "$@" -help | $paginate;;