When generating manpages, delete outdated targets first.
[git/jrn.git] / Documentation / cmd-list.perl
blob2143995ecef4c6175b6e28b180f433581913aa83
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;
15 if ($state == 1 && /^----$/) {
16 $state = 2;
17 next;
19 next if ($state != 2);
20 chomp;
21 $description = $_;
22 last;
24 close I;
25 if (!defined $description) {
26 die "No description found in $name.txt";
28 if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
29 print $out "gitlink:$name\[1\]::\n";
30 print $out "\t$text.\n\n";
32 else {
33 die "Description does not match $name: $description";
37 my %cmds = ();
38 while (<DATA>) {
39 next if /^#/;
41 chomp;
42 my ($name, $cat) = /^(\S+)\s+(.*)$/;
43 push @{$cmds{$cat}}, $name;
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, $_);
60 close O;
62 if (-f "$out" && compare("$out", "$out+") == 0) {
63 unlink "$out+";
65 else {
66 print STDERR "$out\n";
67 rename "$out+", "$out";
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-citool mainporcelain
90 git-clean mainporcelain
91 git-clone mainporcelain
92 git-commit mainporcelain
93 git-commit-tree plumbingmanipulators
94 git-convert-objects ancillarymanipulators
95 git-count-objects ancillaryinterrogators
96 git-cvsexportcommit foreignscminterface
97 git-cvsimport foreignscminterface
98 git-cvsserver foreignscminterface
99 git-daemon synchingrepositories
100 git-describe mainporcelain
101 git-diff-files plumbinginterrogators
102 git-diff-index plumbinginterrogators
103 git-diff mainporcelain
104 git-diff-tree plumbinginterrogators
105 git-fast-import ancillarymanipulators
106 git-fetch mainporcelain
107 git-fetch-pack synchingrepositories
108 git-filter-branch ancillarymanipulators
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-gui mainporcelain
117 git-hash-object plumbingmanipulators
118 git-http-fetch synchelpers
119 git-http-push synchelpers
120 git-imap-send foreignscminterface
121 git-index-pack plumbingmanipulators
122 git-init mainporcelain
123 git-instaweb ancillaryinterrogators
124 gitk mainporcelain
125 git-local-fetch synchingrepositories
126 git-log mainporcelain
127 git-lost-found ancillarymanipulators
128 git-ls-files plumbinginterrogators
129 git-ls-remote plumbinginterrogators
130 git-ls-tree plumbinginterrogators
131 git-mailinfo purehelpers
132 git-mailsplit purehelpers
133 git-merge-base plumbinginterrogators
134 git-merge-file plumbingmanipulators
135 git-merge-index plumbingmanipulators
136 git-merge mainporcelain
137 git-merge-one-file purehelpers
138 git-merge-tree ancillaryinterrogators
139 git-mergetool ancillarymanipulators
140 git-mktag plumbingmanipulators
141 git-mktree plumbingmanipulators
142 git-mv mainporcelain
143 git-name-rev plumbinginterrogators
144 git-pack-objects plumbingmanipulators
145 git-pack-redundant plumbinginterrogators
146 git-pack-refs ancillarymanipulators
147 git-parse-remote synchelpers
148 git-patch-id purehelpers
149 git-peek-remote purehelpers
150 git-prune ancillarymanipulators
151 git-prune-packed plumbingmanipulators
152 git-pull mainporcelain
153 git-push mainporcelain
154 git-quiltimport foreignscminterface
155 git-read-tree plumbingmanipulators
156 git-rebase mainporcelain
157 git-receive-pack synchelpers
158 git-reflog ancillarymanipulators
159 git-relink ancillarymanipulators
160 git-repack ancillarymanipulators
161 git-config ancillarymanipulators
162 git-remote ancillarymanipulators
163 git-request-pull foreignscminterface
164 git-rerere ancillaryinterrogators
165 git-reset mainporcelain
166 git-revert mainporcelain
167 git-rev-list plumbinginterrogators
168 git-rev-parse ancillaryinterrogators
169 git-rm mainporcelain
170 git-runstatus ancillaryinterrogators
171 git-send-email foreignscminterface
172 git-send-pack synchingrepositories
173 git-shell synchelpers
174 git-shortlog mainporcelain
175 git-show mainporcelain
176 git-show-branch ancillaryinterrogators
177 git-show-index plumbinginterrogators
178 git-show-ref plumbinginterrogators
179 git-sh-setup purehelpers
180 git-ssh-fetch synchingrepositories
181 git-ssh-upload synchingrepositories
182 git-stash mainporcelain
183 git-status mainporcelain
184 git-stripspace purehelpers
185 git-submodule mainporcelain
186 git-svn foreignscminterface
187 git-svnimport foreignscminterface
188 git-symbolic-ref plumbingmanipulators
189 git-tag mainporcelain
190 git-tar-tree plumbinginterrogators
191 git-unpack-file plumbinginterrogators
192 git-unpack-objects plumbingmanipulators
193 git-update-index plumbingmanipulators
194 git-update-ref plumbingmanipulators
195 git-update-server-info synchingrepositories
196 git-upload-archive synchelpers
197 git-upload-pack synchelpers
198 git-var plumbinginterrogators
199 git-verify-pack plumbinginterrogators
200 git-verify-tag ancillaryinterrogators
201 git-whatchanged ancillaryinterrogators
202 git-write-tree plumbingmanipulators