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