b54382b2bfdfc7926af8c4b0552f82235619f1c6
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-bundle mainporcelain
74git-cat-file plumbinginterrogators
75git-checkout-index plumbingmanipulators
76git-checkout mainporcelain
77git-check-ref-format purehelpers
78git-cherry ancillaryinterrogators
79git-cherry-pick mainporcelain
80git-clean mainporcelain
81git-clone mainporcelain
82git-commit mainporcelain
83git-commit-tree plumbingmanipulators
84git-convert-objects ancillarymanipulators
85git-count-objects ancillaryinterrogators
86git-cvsexportcommit foreignscminterface
87git-cvsimport foreignscminterface
88git-cvsserver foreignscminterface
89git-daemon synchingrepositories
90git-describe mainporcelain
91git-diff-files plumbinginterrogators
92git-diff-index plumbinginterrogators
93git-diff mainporcelain
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-mergetool ancillarymanipulators
128git-mktag plumbingmanipulators
129git-mktree plumbingmanipulators
130git-mv mainporcelain
131git-name-rev plumbinginterrogators
132git-pack-objects plumbingmanipulators
133git-pack-redundant plumbinginterrogators
134git-pack-refs ancillarymanipulators
135git-parse-remote synchelpers
136git-patch-id purehelpers
137git-peek-remote purehelpers
138git-prune ancillarymanipulators
139git-prune-packed plumbingmanipulators
140git-pull mainporcelain
141git-push mainporcelain
142git-quiltimport foreignscminterface
143git-read-tree plumbingmanipulators
144git-rebase mainporcelain
145git-receive-pack synchelpers
146git-reflog ancillarymanipulators
147git-relink ancillarymanipulators
148git-repack ancillarymanipulators
149git-config ancillarymanipulators
150git-remote ancillarymanipulators
151git-request-pull foreignscminterface
152git-rerere ancillaryinterrogators
153git-reset 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