From cf573ba318dbad4a05d3a052def27e8deb0b40e3 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 10 Aug 2018 15:13:50 +0200 Subject: Add mutt-ccze Signed-off-by: Florian Pritz --- mutt-ccze | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 mutt-ccze 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 () { + my $in_header = 1 .. /^$/; + my $in_body = /^$/ .. eof; + + if ($in_header) { + print $_; + } else { + assert($in_body); + $in .= $_; + } +} + +finish $colorizer; +print $out; -- cgit v1.2.3-24-g4f1b