git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] send-email: support coloring dry-run output
@ 2012-05-17 13:16 Nguyễn Thái Ngọc Duy
  2012-05-17 14:27 ` Angus Hammond
  0 siblings, 1 reply; 3+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2012-05-17 13:16 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy

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.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 git-send-email.perl |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index ef30c55..033ca5e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -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";
-- 
1.7.8.36.g69ee2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] send-email: support coloring dry-run output
  2012-05-17 13:16 [PATCH] send-email: support coloring dry-run output Nguyễn Thái Ngọc Duy
@ 2012-05-17 14:27 ` Angus Hammond
  2012-05-18  4:26   ` Nguyen Thai Ngoc Duy
  0 siblings, 1 reply; 3+ messages in thread
From: Angus Hammond @ 2012-05-17 14:27 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] send-email: support coloring dry-run output
  2012-05-17 14:27 ` Angus Hammond
@ 2012-05-18  4:26   ` Nguyen Thai Ngoc Duy
  0 siblings, 0 replies; 3+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2012-05-18  4:26 UTC (permalink / raw)
  To: Angus Hammond; +Cc: git

On Thu, May 17, 2012 at 9:27 PM, Angus Hammond <angusgh@gmail.com> wrote:
> 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.
-- 
Duy

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-18  4:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-17 13:16 [PATCH] send-email: support coloring dry-run output Nguyễn Thái Ngọc Duy
2012-05-17 14:27 ` Angus Hammond
2012-05-18  4:26   ` Nguyen Thai Ngoc Duy

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).