Revision 79a77109d3d0d364910ff7fa8c605c554dc4c3e0 authored by René Scharfe on 27 October 2014, 18:23:05 UTC, committed by Junio C Hamano on 28 October 2014, 17:33:50 UTC
The config option color.grep.match can be used to specify the highlighting color for matching strings. Add the options matchContext and matchSelected to allow different colors to be specified for matching strings in the context vs. in selected lines. This is similar to the ms and mc specifiers in GNU grep's environment variable GREP_COLORS. Tests are from Zoltan Klinger's earlier attempt to solve the same issue in a different way. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent eeff891
cmd-list.perl
#!/usr/bin/perl -w
use File::Compare qw(compare);
sub format_one {
my ($out, $nameattr) = @_;
my ($name, $attr) = @$nameattr;
my ($state, $description);
$state = 0;
open I, '<', "$name.txt" or die "No such file $name.txt";
while (<I>) {
if (/^NAME$/) {
$state = 1;
next;
}
if ($state == 1 && /^----$/) {
$state = 2;
next;
}
next if ($state != 2);
chomp;
$description = $_;
last;
}
close I;
if (!defined $description) {
die "No description found in $name.txt";
}
if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
print $out "linkgit:$name\[1\]::\n\t";
if ($attr =~ / deprecated /) {
print $out "(deprecated) ";
}
print $out "$text.\n\n";
}
else {
die "Description does not match $name: $description";
}
}
my %cmds = ();
for (sort <>) {
next if /^#/;
chomp;
my ($name, $cat, $attr) = /^(\S+)\s+(.*?)(?:\s+(.*))?$/;
$attr = '' unless defined $attr;
push @{$cmds{$cat}}, [$name, " $attr "];
}
for my $cat (qw(ancillaryinterrogators
ancillarymanipulators
mainporcelain
plumbinginterrogators
plumbingmanipulators
synchingrepositories
foreignscminterface
purehelpers
synchelpers)) {
my $out = "cmds-$cat.txt";
open O, '>', "$out+" or die "Cannot open output file $out+";
for (@{$cmds{$cat}}) {
format_one(\*O, $_);
}
close O;
if (-f "$out" && compare("$out", "$out+") == 0) {
unlink "$out+";
}
else {
print STDERR "$out\n";
rename "$out+", "$out";
}
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...