Merge branch 'master' of git://repo.or.cz/git-gui
[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 __DATA__
72 git-add                                 mainporcelain
73 git-am                                  mainporcelain
74 git-annotate                            ancillaryinterrogators
75 git-applymbox                           ancillaryinterrogators
76 git-applypatch                          purehelpers
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-checkout-index                      plumbingmanipulators
86 git-checkout                            mainporcelain
87 git-check-attr                          purehelpers
88 git-check-ref-format                    purehelpers
89 git-cherry                              ancillaryinterrogators
90 git-cherry-pick                         mainporcelain
91 git-clean                               mainporcelain
92 git-clone                               mainporcelain
93 git-commit                              mainporcelain
94 git-commit-tree                         plumbingmanipulators
95 git-convert-objects                     ancillarymanipulators
96 git-count-objects                       ancillaryinterrogators
97 git-cvsexportcommit                     foreignscminterface
98 git-cvsimport                           foreignscminterface
99 git-cvsserver                           foreignscminterface
100 git-daemon                              synchingrepositories
101 git-describe                            mainporcelain
102 git-diff-files                          plumbinginterrogators
103 git-diff-index                          plumbinginterrogators
104 git-diff                                mainporcelain
105 git-diff-tree                           plumbinginterrogators
106 git-fast-import                         ancillarymanipulators
107 git-fetch                               mainporcelain
108 git-fetch-pack                          synchingrepositories
109 git-fmt-merge-msg                       purehelpers
110 git-for-each-ref                        plumbinginterrogators
111 git-format-patch                        mainporcelain
112 git-fsck                                ancillaryinterrogators
113 git-gc                                  mainporcelain
114 git-get-tar-commit-id                   ancillaryinterrogators
115 git-grep                                mainporcelain
116 git-hash-object                         plumbingmanipulators
117 git-http-fetch                          synchelpers
118 git-http-push                           synchelpers
119 git-imap-send                           foreignscminterface
120 git-index-pack                          plumbingmanipulators
121 git-init                                mainporcelain
122 git-instaweb                            ancillaryinterrogators
123 gitk                                    mainporcelain
124 git-local-fetch                         synchingrepositories
125 git-log                                 mainporcelain
126 git-lost-found                          ancillarymanipulators
127 git-ls-files                            plumbinginterrogators
128 git-ls-remote                           plumbinginterrogators
129 git-ls-tree                             plumbinginterrogators
130 git-mailinfo                            purehelpers
131 git-mailsplit                           purehelpers
132 git-merge-base                          plumbinginterrogators
133 git-merge-file                          plumbingmanipulators
134 git-merge-index                         plumbingmanipulators
135 git-merge                               mainporcelain
136 git-merge-one-file                      purehelpers
137 git-merge-tree                          ancillaryinterrogators
138 git-mergetool                           ancillarymanipulators
139 git-mktag                               plumbingmanipulators
140 git-mktree                              plumbingmanipulators
141 git-mv                                  mainporcelain
142 git-name-rev                            plumbinginterrogators
143 git-pack-objects                        plumbingmanipulators
144 git-pack-redundant                      plumbinginterrogators
145 git-pack-refs                           ancillarymanipulators
146 git-parse-remote                        synchelpers
147 git-patch-id                            purehelpers
148 git-peek-remote                         purehelpers
149 git-prune                               ancillarymanipulators
150 git-prune-packed                        plumbingmanipulators
151 git-pull                                mainporcelain
152 git-push                                mainporcelain
153 git-quiltimport                         foreignscminterface
154 git-read-tree                           plumbingmanipulators
155 git-rebase                              mainporcelain
156 git-receive-pack                        synchelpers
157 git-reflog                              ancillarymanipulators
158 git-relink                              ancillarymanipulators
159 git-repack                              ancillarymanipulators
160 git-config                              ancillarymanipulators
161 git-remote                              ancillarymanipulators
162 git-request-pull                        foreignscminterface
163 git-rerere                              ancillaryinterrogators
164 git-reset                               mainporcelain
165 git-revert                              mainporcelain
166 git-rev-list                            plumbinginterrogators
167 git-rev-parse                           ancillaryinterrogators
168 git-rm                                  mainporcelain
169 git-runstatus                           ancillaryinterrogators
170 git-send-email                          foreignscminterface
171 git-send-pack                           synchingrepositories
172 git-shell                               synchelpers
173 git-shortlog                            mainporcelain
174 git-show                                mainporcelain
175 git-show-branch                         ancillaryinterrogators
176 git-show-index                          plumbinginterrogators
177 git-show-ref                            plumbinginterrogators
178 git-sh-setup                            purehelpers
179 git-ssh-fetch                           synchingrepositories
180 git-ssh-upload                          synchingrepositories
181 git-status                              mainporcelain
182 git-stripspace                          purehelpers
183 git-svn                                 foreignscminterface
184 git-svnimport                           foreignscminterface
185 git-symbolic-ref                        plumbingmanipulators
186 git-tag                                 mainporcelain
187 git-tar-tree                            plumbinginterrogators
188 git-unpack-file                         plumbinginterrogators
189 git-unpack-objects                      plumbingmanipulators
190 git-update-index                        plumbingmanipulators
191 git-update-ref                          plumbingmanipulators
192 git-update-server-info                  synchingrepositories
193 git-upload-archive                      synchelpers
194 git-upload-pack                         synchelpers
195 git-var                                 plumbinginterrogators
196 git-verify-pack                         plumbinginterrogators
197 git-verify-tag                          ancillaryinterrogators
198 git-whatchanged                         ancillaryinterrogators
199 git-write-tree                          plumbingmanipulators