645e4372e5e82e8f06cb9aec2addab2989acdcad
1 #!/usr/bin/perl -w
3 use File::Compare qw(compare);
5 sub 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 }
37 my %cmds = ();
38 while (<DATA>) {
39 next if /^#/;
41 chomp;
42 my ($name, $cat) = /^(\S+)\s+(.*)$/;
43 push @{$cmds{$cat}}, $name;
44 }
46 for 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;
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 }
71 __DATA__
72 git-add mainporcelain
73 git-am mainporcelain
74 git-annotate ancillaryinterrogators
75 git-apply plumbingmanipulators
76 git-archimport foreignscminterface
77 git-archive mainporcelain
78 git-bisect mainporcelain
79 git-blame ancillaryinterrogators
80 git-branch mainporcelain
81 git-bundle mainporcelain
82 git-cat-file plumbinginterrogators
83 git-checkout-index plumbingmanipulators
84 git-checkout mainporcelain
85 git-check-attr purehelpers
86 git-check-ref-format purehelpers
87 git-cherry ancillaryinterrogators
88 git-cherry-pick mainporcelain
89 git-clean mainporcelain
90 git-clone mainporcelain
91 git-commit mainporcelain
92 git-commit-tree plumbingmanipulators
93 git-convert-objects ancillarymanipulators
94 git-count-objects ancillaryinterrogators
95 git-cvsexportcommit foreignscminterface
96 git-cvsimport foreignscminterface
97 git-cvsserver foreignscminterface
98 git-daemon synchingrepositories
99 git-describe mainporcelain
100 git-diff-files plumbinginterrogators
101 git-diff-index plumbinginterrogators
102 git-diff mainporcelain
103 git-diff-tree plumbinginterrogators
104 git-fast-import ancillarymanipulators
105 git-fetch mainporcelain
106 git-fetch-pack synchingrepositories
107 git-fmt-merge-msg purehelpers
108 git-for-each-ref plumbinginterrogators
109 git-format-patch mainporcelain
110 git-fsck ancillaryinterrogators
111 git-gc mainporcelain
112 git-get-tar-commit-id ancillaryinterrogators
113 git-grep mainporcelain
114 git-hash-object plumbingmanipulators
115 git-http-fetch synchelpers
116 git-http-push synchelpers
117 git-imap-send foreignscminterface
118 git-index-pack plumbingmanipulators
119 git-init mainporcelain
120 git-instaweb ancillaryinterrogators
121 gitk mainporcelain
122 git-local-fetch synchingrepositories
123 git-log mainporcelain
124 git-lost-found ancillarymanipulators
125 git-ls-files plumbinginterrogators
126 git-ls-remote plumbinginterrogators
127 git-ls-tree plumbinginterrogators
128 git-mailinfo purehelpers
129 git-mailsplit purehelpers
130 git-merge-base plumbinginterrogators
131 git-merge-file plumbingmanipulators
132 git-merge-index plumbingmanipulators
133 git-merge mainporcelain
134 git-merge-one-file purehelpers
135 git-merge-tree ancillaryinterrogators
136 git-mergetool ancillarymanipulators
137 git-mktag plumbingmanipulators
138 git-mktree plumbingmanipulators
139 git-mv mainporcelain
140 git-name-rev plumbinginterrogators
141 git-pack-objects plumbingmanipulators
142 git-pack-redundant plumbinginterrogators
143 git-pack-refs ancillarymanipulators
144 git-parse-remote synchelpers
145 git-patch-id purehelpers
146 git-peek-remote purehelpers
147 git-prune ancillarymanipulators
148 git-prune-packed plumbingmanipulators
149 git-pull mainporcelain
150 git-push mainporcelain
151 git-quiltimport foreignscminterface
152 git-read-tree plumbingmanipulators
153 git-rebase mainporcelain
154 git-receive-pack synchelpers
155 git-reflog ancillarymanipulators
156 git-relink ancillarymanipulators
157 git-repack ancillarymanipulators
158 git-config ancillarymanipulators
159 git-remote ancillarymanipulators
160 git-request-pull foreignscminterface
161 git-rerere ancillaryinterrogators
162 git-reset mainporcelain
163 git-revert mainporcelain
164 git-rev-list plumbinginterrogators
165 git-rev-parse ancillaryinterrogators
166 git-rm mainporcelain
167 git-runstatus ancillaryinterrogators
168 git-send-email foreignscminterface
169 git-send-pack synchingrepositories
170 git-shell synchelpers
171 git-shortlog mainporcelain
172 git-show mainporcelain
173 git-show-branch ancillaryinterrogators
174 git-show-index plumbinginterrogators
175 git-show-ref plumbinginterrogators
176 git-sh-setup purehelpers
177 git-ssh-fetch synchingrepositories
178 git-ssh-upload synchingrepositories
179 git-status mainporcelain
180 git-stripspace purehelpers
181 git-svn foreignscminterface
182 git-svnimport foreignscminterface
183 git-symbolic-ref plumbingmanipulators
184 git-tag mainporcelain
185 git-tar-tree plumbinginterrogators
186 git-unpack-file plumbinginterrogators
187 git-unpack-objects plumbingmanipulators
188 git-update-index plumbingmanipulators
189 git-update-ref plumbingmanipulators
190 git-update-server-info synchingrepositories
191 git-upload-archive synchelpers
192 git-upload-pack synchelpers
193 git-var plumbinginterrogators
194 git-verify-pack plumbinginterrogators
195 git-verify-tag ancillaryinterrogators
196 git-whatchanged ancillaryinterrogators
197 git-write-tree plumbingmanipulators