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