Print the error messages that go to STDERR in color.interactive.help. While it's not really help text, the command help also pops up if an unknown command was entered (which is an error), and it lets them stand out nicely. Signed-off-by: Thomas Rast <trast@xxxxxxxxxxxxxxx> --- git-add--interactive.perl | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/git-add--interactive.perl b/git-add--interactive.perl index 3aa21db..fe8f364 100755 --- a/git-add--interactive.perl +++ b/git-add--interactive.perl @@ -908,6 +908,10 @@ sub display_hunks { return $i; } +sub help_msg { + print STDERR colored $help_color, @_; +} + sub patch_update_file { my ($ix, $num); my $path = shift; @@ -1029,11 +1033,11 @@ sub patch_update_file { chomp $response; } if ($response !~ /^\s*\d+\s*$/) { - print STDERR "Invalid number: '$response'\n"; + help_msg "Invalid number: '$response'\n"; } elsif (0 < $response && $response <= $num) { $ix = $response - 1; } else { - print STDERR "Sorry, only $num hunks available.\n"; + help_msg "Sorry, only $num hunks available.\n"; } next; } @@ -1062,7 +1066,7 @@ sub patch_update_file { if ($@) { my ($err,$exp) = ($@, $1); $err =~ s/ at .*git-add--interactive line \d+, <STDIN> line \d+.*$//; - print STDERR "Malformed search regexp $exp: $err\n"; + help_msg "Malformed search regexp $exp: $err\n"; next; } my $iy = $ix; @@ -1072,7 +1076,7 @@ sub patch_update_file { $iy++; $iy = 0 if ($iy >= $num); if ($ix == $iy) { - print STDERR "No hunk matches the given pattern\n"; + help_msg "No hunk matches the given pattern\n"; last; } } @@ -1084,7 +1088,7 @@ sub patch_update_file { $ix--; } else { - print STDERR "No previous hunk\n"; + help_msg "No previous hunk\n"; } next; } @@ -1093,7 +1097,7 @@ sub patch_update_file { $ix++; } else { - print STDERR "No next hunk\n"; + help_msg "No next hunk\n"; } next; } @@ -1106,13 +1110,13 @@ sub patch_update_file { } } else { - print STDERR "No previous hunk\n"; + help_msg "No previous hunk\n"; } next; } elsif ($line =~ /^j/) { if ($other !~ /j/) { - print STDERR "No next hunk\n"; + help_msg "No next hunk\n"; next; } } -- 1.6.1.2.513.g04677 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html