send-email: support coloring dry-run output
PATCH 1/1 send-email: support coloring dry-run output
It highlights sendmail command and subject lines. The most important lines to me.
I'm no Perl expert. This patch is by no means for submission. But maybe it'll motivate someone to do a proper patch.
--- git-send-email.perl | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
git-send-email.perl +5 -1
@@ -1157,9 +1157,13 @@ X-Mailer: git-send-email $gitversion print "RCPT TO:<$entry>\n"; } } else { + print color 'yellow'; print "Sendmail: $smtp_server ".join(' ',@sendmail_parameters)."\n"; + print color 'reset'; } - print $header, "\n"; + my $colored_header = $header; + $colored_header =~ s/^(Subject: .*)/color("bold").$1.color("reset")/em; + print $colored_header, "\n"; if ($smtp) { print "Result: ", $smtp->code, ' ', ($smtp->message =~ /\n([^\n]+\n)$/s), "\n";
Signature · 1 line
1.7.8.36.g69ee2
This seems like it would be a useful patch for those of us using sendmail. I'll admit I don't know any perl at all, but one bit seems a little odd to me. Is there a reason you use 3 separate print statements to deal with the colours on the Sendmail line, but a regex substitution the second time? I have no idea which would be considered the better practice but surely we should pick one and be consistent? Unless there's some difference between the two that I'm missing. Thanks
Angus
Quoted 7 lines · Angus Hammond
This seems like it would be a useful patch for those of us using sendmail. I'll admit I don't know any perl at all, but one bit seems a little odd to me. Is there a reason you use 3 separate print statements to deal with the colours on the Sendmail line, but a regex substitution the second time? I have no idea which would be considered the better practice but surely we should pick one and be consistent? Unless there's some difference between the two that I'm missing.
No reasons. It was what I had in mind at that time and it worked, so I did not bother cleaning up or anything.
Signature · 1 line
Duy