2
## Copyright (C) 2004 Jan Hudec
4
## See the file "COPYING" for further information about
5
## the copyright and warranty status of this work.
27
my ($color, $string) = @_;
28
$color = $color{$color} if exists $color{$color};
29
print "\e[${color};1m${string}\e[0m\n";
33
my ($color, $string) = @_;
34
$color = $color{$color} if exists $color{$color};
35
print "\e[${color}m${string}\e[0m\n";
39
if($] >= 5.008) { # 5.8 has a sane syntax...
40
open STDIN, '-|', qw(tla changes --diffs), @_ or die "Can't run tla";
41
} else { # 5.6's weird syntax...
42
open(STDIN, '-|') || exec(qw(tla changes --diffs), @_) || die "Can't run tla";
46
} or open WP, ">/dev/null";
52
/^(\*\s)/ ? bold wh => $_ :
53
/^(?:\+\+\+|---)/ ? norm gr => $_ :
54
/^\+/ ? bold cy => $_ :
55
/^-/ ? bold re => $_ :
56
/^!/ ? bold bl => $_ :
57
/^diff/ ? norm cy => $_ :
58
/(\@\@.*\@\@)(.*)/ ? print "\e[$color{ye};1m$1\e[$color{wh};1m$2\e[0m\n" :
63
print "---------------------\n";
70
printf "%28s : %s\n", 'cdiff', "tla changes --diffs with pretty colors and summary";
74
print "Generate changes report with pretty colored diffs and diffs summary.\n";
80
It is similar to tla changes --diffs, but colorizes the diff and adds output of
81
diffstat (if you have it) to the end.
82
Highlighting colours headers green, additions cyan, deletions red and tla
83
messages (those with * at the beginning) just bold (everything is bold).
87
if ($ARGV[0] eq 'desc') {
89
} elsif ($ARGV[0] eq 'exec') {
90
if ($ARGV[1] eq '-h' or $ARGV[1] eq '--help') {
92
} elsif ($ARGV[1] eq '-H') {
95
exe(@ARGV[1 .. $#ARGV]);
98
die "Invalid parameters. This script is designed to be run by aba only."
101
# arch-tag: 689f32af-bac3-4621-8697-fd29951bb777