status: document the -v/--verbose option
[alt-git.git] / Documentation / cat-texi.perl
blob87437f8a95768595e040b8c4c1d48e5c29ada087
1 #!/usr/bin/perl -w
3 my @menu = ();
4 my $output = $ARGV[0];
6 open TMP, '>', "$output.tmp";
8 while (<STDIN>) {
9 next if (/^\\input texinfo/../\@node Top/);
10 next if (/^\@bye/ || /^\.ft/);
11 if (s/^\@top (.*)/\@node $1,,,Top/) {
12 push @menu, $1;
14 s/\(\@pxref{\[(URLS|REMOTES)\]}\)//;
15 s/\@anchor\{[^{}]*\}//g;
16 print TMP;
18 close TMP;
20 printf '\input texinfo
21 @setfilename gitman.info
22 @documentencoding UTF-8
23 @dircategory Development
24 @direntry
25 * Git Man Pages: (gitman). Manual pages for Git revision control system
26 @end direntry
27 @node Top,,, (dir)
28 @top Git Manual Pages
29 @documentlanguage en
30 @menu
31 ', $menu[0];
33 for (@menu) {
34 print "* ${_}::\n";
36 print "\@end menu\n";
37 open TMP, '<', "$output.tmp";
38 while (<TMP>) {
39 print;
41 close TMP;
42 print "\@bye\n";
43 unlink "$output.tmp";