summaryrefslogtreecommitdiffstats
path: root/mutt-ccze
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-08-10 15:13:50 +0200
committerFlorian Pritz <bluewind@xinu.at>2018-08-10 15:13:50 +0200
commitcf573ba318dbad4a05d3a052def27e8deb0b40e3 (patch)
tree89988b626cf9f948e6934371d44e5e0f6b2ca26f /mutt-ccze
parentcf825a17e91337927fad2738e6816f02136a9c5f (diff)
downloadbin-cf573ba318dbad4a05d3a052def27e8deb0b40e3.tar.gz
bin-cf573ba318dbad4a05d3a052def27e8deb0b40e3.tar.xz
Add mutt-ccze
Signed-off-by: Florian Pritz <bluewind@xinu.at>
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;