summaryrefslogtreecommitdiffstats
path: root/mutt-ccze
diff options
context:
space:
mode:
Diffstat (limited to 'mutt-ccze')
-rwxr-xr-xmutt-ccze26
1 files changed, 26 insertions, 0 deletions
diff --git a/mutt-ccze b/mutt-ccze
new file mode 100755
index 0000000..3bcc935
--- /dev/null
+++ b/mutt-ccze
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Carp::Assert;
+use IPC::Run qw(start);
+
+my ($in, $out);
+
+my $colorizer = start [qw(ccze -A -o), 'nolookups,transparent'], \$in, \$out;
+
+while (<STDIN>) {
+ my $in_header = 1 .. /^$/;
+ my $in_body = /^$/ .. eof;
+
+ if ($in_header) {
+ print $_;
+ } else {
+ assert($in_body);
+ $in .= $_;
+ }
+}
+
+finish $colorizer;
+print $out;