3 use File
::Compare
qw(compare);
6 my ($source_dir, $out, $nameattr) = @_;
7 my ($name, $attr) = @
$nameattr;
8 my ($path) = "$source_dir/Documentation/$name.txt";
9 my ($state, $description);
12 open I
, '<', "$path" or die "No such file $path.txt";
14 if (/^(?:git|scalar)[a-z0-9-]*\(([0-9])\)$/) {
22 if ($state == 1 && /^----$/) {
26 next if ($state != 2);
32 if (!defined $description) {
33 die "No description found in $path.txt";
35 if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
36 print $out "linkgit:$name\[$mansection\]::\n\t";
37 if ($attr =~ / deprecated /) {
38 print $out "(deprecated) ";
40 print $out "$text.\n\n";
43 die "Description does not match $name: $description";
47 my ($source_dir, $build_dir, @categories) = @ARGV;
49 open IN
, "<$source_dir/command-list.txt";
51 last if /^### command list/;
59 my ($name, $cat, $attr) = /^(\S+)\s+(.*?)(?:\s+(.*))?$/;
60 $attr = '' unless defined $attr;
61 push @
{$cmds{$cat}}, [$name, " $attr "];
65 for my $out (@categories) {
66 my ($cat) = $out =~ /^cmds-(.*)\.txt$/;
67 my ($path) = "$build_dir/$out";
68 open O
, '>', "$path+" or die "Cannot open output file $out+";
69 for (@
{$cmds{$cat}}) {
70 format_one
($source_dir, \
*O
, $_);
74 if (-f
"$path" && compare
("$path", "$path+") == 0) {
78 rename "$path+", "$path";