Last active
April 15, 2019 04:05
-
-
Save c02y/bd69a0354332ef5a8cd1f0bd4417b1aa to your computer and use it in GitHub Desktop.
diffs to replace multiple diff alias/abbr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function diffs -d "all kinds of diff features" | |
set -l options 'f' 'w' 'l' 'L' 'W' 'h' | |
argparse -n diffs $options -- $argv | |
or return | |
if set -q _flag_h | |
echo "diffs [-f/-w/-l/-L/-W/-h]" | |
echo " no option --> side by side, only diffs" | |
echo " -f --> like no argument, but print whole files" | |
echo " -w --> like no argument, but ignore all white spaces" | |
echo " -l --> line by line, only diffs" | |
echo " -L --> like -l, but print whole files" | |
echo " -W --> like -l, but ignore all white spaces" | |
echo " -h --> usage" | |
return | |
else if set -q _flag_f | |
diff -r -y -s -W $COLUMNS $argv | less | |
else if set -q _flag_w | |
diff -r -y -s --suppress-common-line -W $COLUMNS -w $argv | less | |
else if set -q _flag_l | |
diff -r -s --suppress-common-line -W $COLUMNS $argv | less | |
else if set -q _flag_L | |
diff -r -s -W $COLUMNS $argv | less | |
else if set -q _flag_W | |
diff -r -s --suppress-common-line -W $COLUMNS -w $argv | less | |
else # no option | |
diff -r -y -s --suppress-common-line -W $COLUMNS $argv | less | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment