Last active
May 6, 2024 02:28
-
-
Save obfusk/f7522fad46899c29004f123a4d41817a to your computer and use it in GitHub Desktop.
diff + bat
This file contains 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
#!/bin/bash | |
diff -Naur "$@" | bat -p -l diff |
This file contains 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
#!/bin/bash | |
# diff running 2 different commands on the same file | |
set -e | |
if [ "$#" -lt 3 ]; then | |
echo 'usage: diff2c CMD_A CMD_B FILE' >&2 | |
exit 1 | |
fi | |
cmd_a="$1" cmd_b="$2" file="$3" | |
diff -Naur <( $cmd_a "$file" ) <( $cmd_b "$file" ) | bat -p -l diff |
This file contains 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
#!/bin/bash | |
# diff running the same command on 2 different files | |
set -e | |
if [ "$#" -lt 3 ]; then | |
echo 'usage: diff2f CMD FILE_A FILE_B' >&2 | |
exit 1 | |
fi | |
cmd="$1" file_a="$2" file_b="$3" | |
diff -Naur <( $cmd "$file_a" ) <( $cmd "$file_b" ) | bat -p -l diff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment