Created
January 12, 2012 09:19
-
-
Save cincauhangus/1599540 to your computer and use it in GitHub Desktop.
Colored Diff
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
| #!/usr/bin/env perl | |
| # a simple modification of the Diff implementation | |
| use Term::ANSIColor qw(:constants); | |
| $Term::ANSIColor::AUTORESET = 1; | |
| die "usage: cdiff file1 file2\n" unless (@ARGV == 2); | |
| open DIFF, "diff $ARGV[0] $ARGV[1] |" || die ($!); | |
| while (<DIFF>) { | |
| print /^</ ? BOLD RED $_ | |
| : /^>/ ? BOLD BLUE $_ | |
| : /^-/ ? BOLD GREEN $_ | |
| : /^\d/ ? BOLD YELLOW $_ | |
| : $_; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment