1#!/usr/bin/perl -w
2
3use File::Compare qw(compare);
4
5sub format_one {
6 my ($out, $name) = @_;
7 my ($state, $description);
8 $state = 0;
9 open I, '<', "$name.txt" or die "No such file $name.txt";
10 while (<I>) {
11 if (/^NAME$/) {
12 $state = 1;
13 next;
14 }
15 if ($state == 1 && /^----$/) {
16 $state = 2;
17 next;
18 }
19 next if ($state != 2);
20 chomp;
21 $description = $_;
22 last;
23 }
24 close I;
25 if (!defined $description) {
26 die "No description found in $name.txt";
27 }
28 if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
29 print $out "gitlink:$name\[1\]::\n";
30 print $out "\t$text.\n\n";
31 }
32 else {
33 die "Description does not match $name: $description";
34 }
35}
36
37my %cmds = ();
38while (<DATA>) {
39 next if /^#/;
40
41 chomp;
42 my ($name, $cat) = /^(\S+)\s+(.*)$/;
43 push @{$cmds{$cat}}, $name;
44}
45
46for my $cat (qw(ancillaryinterrogators
47 ancillarymanipulators
48 mainporcelain
49 plumbinginterrogators
50 plumbingmanipulators
51 synchingrepositories
52 foreignscminterface
53 purehelpers
54 synchelpers)) {
55 my $out = "cmds-$cat.txt";
56 open O, '>', "$out+" or die "Cannot open output file $out+";
57 for (@{$cmds{$cat}}) {
58 format_one(\*O, $_);
59 }
60 close O;
61
62 if (-f "$out" && compare("$out", "$out+") == 0) {
63 unlink "$out+";
64 }
65 else {
66 print STDERR "$out\n";
67 rename "$out+", "$out";
68 }
69}
70
71# The following list is sorted with "sort -d" to make it easier
72# to find entry in the resulting git.html manual page.
73__DATA__
74git-add mainporcelain
75git-am mainporcelain
76git-annotate ancillaryinterrogators
77git-apply plumbingmanipulators
78git-archimport foreignscminterface
79git-archive mainporcelain
80git-bisect mainporcelain
81git-blame ancillaryinterrogators
82git-branch mainporcelain
83git-bundle mainporcelain
84git-cat-file plumbinginterrogators
85git-check-attr purehelpers
86git-checkout mainporcelain
87git-checkout-index plumbingmanipulators
88git-check-ref-format purehelpers
89git-cherry ancillaryinterrogators
90git-cherry-pick mainporcelain
91git-citool mainporcelain
92git-clean mainporcelain
93git-clone mainporcelain
94git-commit mainporcelain
95git-commit-tree plumbingmanipulators
96git-config ancillarymanipulators
97git-count-objects ancillaryinterrogators
98git-cvsexportcommit foreignscminterface
99git-cvsimport foreignscminterface
100git-cvsserver foreignscminterface
101git-daemon synchingrepositories
102git-describe mainporcelain
103git-diff mainporcelain
104git-diff-files plumbinginterrogators
105git-diff-index plumbinginterrogators
106git-diff-tree plumbinginterrogators
107git-fast-import ancillarymanipulators
108git-fetch mainporcelain
109git-fetch-pack synchingrepositories
110git-filter-branch ancillarymanipulators
111git-fmt-merge-msg purehelpers
112git-for-each-ref plumbinginterrogators
113git-format-patch mainporcelain
114git-fsck ancillaryinterrogators
115git-gc mainporcelain
116git-get-tar-commit-id ancillaryinterrogators
117git-grep mainporcelain
118git-gui mainporcelain
119git-hash-object plumbingmanipulators
120git-http-fetch synchelpers
121git-http-push synchelpers
122git-imap-send foreignscminterface
123git-index-pack plumbingmanipulators
124git-init mainporcelain
125git-instaweb ancillaryinterrogators
126gitk mainporcelain
127git-local-fetch synchingrepositories
128git-log mainporcelain
129git-lost-found ancillarymanipulators
130git-ls-files plumbinginterrogators
131git-ls-remote plumbinginterrogators
132git-ls-tree plumbinginterrogators
133git-mailinfo purehelpers
134git-mailsplit purehelpers
135git-merge mainporcelain
136git-merge-base plumbinginterrogators
137git-merge-file plumbingmanipulators
138git-merge-index plumbingmanipulators
139git-merge-one-file purehelpers
140git-mergetool ancillarymanipulators
141git-merge-tree ancillaryinterrogators
142git-mktag plumbingmanipulators
143git-mktree plumbingmanipulators
144git-mv mainporcelain
145git-name-rev plumbinginterrogators
146git-pack-objects plumbingmanipulators
147git-pack-redundant plumbinginterrogators
148git-pack-refs ancillarymanipulators
149git-parse-remote synchelpers
150git-patch-id purehelpers
151git-peek-remote purehelpers
152git-prune ancillarymanipulators
153git-prune-packed plumbingmanipulators
154git-pull mainporcelain
155git-push mainporcelain
156git-quiltimport foreignscminterface
157git-read-tree plumbingmanipulators
158git-rebase mainporcelain
159git-receive-pack synchelpers
160git-reflog ancillarymanipulators
161git-relink ancillarymanipulators
162git-remote ancillarymanipulators
163git-repack ancillarymanipulators
164git-request-pull foreignscminterface
165git-rerere ancillaryinterrogators
166git-reset mainporcelain
167git-revert mainporcelain
168git-rev-list plumbinginterrogators
169git-rev-parse ancillaryinterrogators
170git-rm mainporcelain
171git-runstatus ancillaryinterrogators
172git-send-email foreignscminterface
173git-send-pack synchingrepositories
174git-shell synchelpers
175git-shortlog mainporcelain
176git-show mainporcelain
177git-show-branch ancillaryinterrogators
178git-show-index plumbinginterrogators
179git-show-ref plumbinginterrogators
180git-sh-setup purehelpers
181git-ssh-fetch synchingrepositories
182git-ssh-upload synchingrepositories
183git-stash mainporcelain
184git-status mainporcelain
185git-stripspace purehelpers
186git-submodule mainporcelain
187git-svn foreignscminterface
188git-svnimport foreignscminterface
189git-symbolic-ref plumbingmanipulators
190git-tag mainporcelain
191git-tar-tree plumbinginterrogators
192git-unpack-file plumbinginterrogators
193git-unpack-objects plumbingmanipulators
194git-update-index plumbingmanipulators
195git-update-ref plumbingmanipulators
196git-update-server-info synchingrepositories
197git-upload-archive synchelpers
198git-upload-pack synchelpers
199git-var plumbinginterrogators
200git-verify-pack plumbinginterrogators
201git-verify-tag ancillaryinterrogators
202git-whatchanged ancillaryinterrogators
203git-write-tree plumbingmanipulators