dbe6029af49c8cc5d651085bbfe7904371beb09e
[git/git.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, $nameattr) = @_;
7 my ($name, $attr) = @$nameattr;
8 my ($state, $description);
9 $state = 0;
10 open I, '<', "$name.txt" or die "No such file $name.txt";
11 while (<I>) {
12 if (/^NAME$/) {
13 $state = 1;
14 next;
15 }
16 if ($state == 1 && /^----$/) {
17 $state = 2;
18 next;
19 }
20 next if ($state != 2);
21 chomp;
22 $description = $_;
23 last;
24 }
25 close I;
26 if (!defined $description) {
27 die "No description found in $name.txt";
28 }
29 if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) {
30 print $out "gitlink:$name\[1\]::\n\t";
31 if ($attr) {
32 print $out "($attr) ";
33 }
34 print $out "$text.\n\n";
35 }
36 else {
37 die "Description does not match $name: $description";
38 }
39 }
40
41 my %cmds = ();
42 while (<DATA>) {
43 next if /^#/;
44
45 chomp;
46 my ($name, $cat, $attr) = /^(\S+)\s+(.*?)(?:\s+(.*))?$/;
47 push @{$cmds{$cat}}, [$name, $attr];
48 }
49
50 for my $cat (qw(ancillaryinterrogators
51 ancillarymanipulators
52 mainporcelain
53 plumbinginterrogators
54 plumbingmanipulators
55 synchingrepositories
56 foreignscminterface
57 purehelpers
58 synchelpers)) {
59 my $out = "cmds-$cat.txt";
60 open O, '>', "$out+" or die "Cannot open output file $out+";
61 for (@{$cmds{$cat}}) {
62 format_one(\*O, $_);
63 }
64 close O;
65
66 if (-f "$out" && compare("$out", "$out+") == 0) {
67 unlink "$out+";
68 }
69 else {
70 print STDERR "$out\n";
71 rename "$out+", "$out";
72 }
73 }
74
75 # The following list is sorted with "sort -d" to make it easier
76 # to find entry in the resulting git.html manual page.
77 __DATA__
78 git-add mainporcelain
79 git-am mainporcelain
80 git-annotate ancillaryinterrogators
81 git-apply plumbingmanipulators
82 git-archimport foreignscminterface
83 git-archive mainporcelain
84 git-bisect mainporcelain
85 git-blame ancillaryinterrogators
86 git-branch mainporcelain
87 git-bundle mainporcelain
88 git-cat-file plumbinginterrogators
89 git-check-attr purehelpers
90 git-checkout mainporcelain
91 git-checkout-index plumbingmanipulators
92 git-check-ref-format purehelpers
93 git-cherry ancillaryinterrogators
94 git-cherry-pick mainporcelain
95 git-citool mainporcelain
96 git-clean mainporcelain
97 git-clone mainporcelain
98 git-commit mainporcelain
99 git-commit-tree plumbingmanipulators
100 git-config ancillarymanipulators
101 git-count-objects ancillaryinterrogators
102 git-cvsexportcommit foreignscminterface
103 git-cvsimport foreignscminterface
104 git-cvsserver foreignscminterface
105 git-daemon synchingrepositories
106 git-describe mainporcelain
107 git-diff mainporcelain
108 git-diff-files plumbinginterrogators
109 git-diff-index plumbinginterrogators
110 git-diff-tree plumbinginterrogators
111 git-fast-import ancillarymanipulators
112 git-fetch mainporcelain
113 git-fetch-pack synchingrepositories
114 git-filter-branch ancillarymanipulators
115 git-fmt-merge-msg purehelpers
116 git-for-each-ref plumbinginterrogators
117 git-format-patch mainporcelain
118 git-fsck ancillaryinterrogators
119 git-gc mainporcelain
120 git-get-tar-commit-id ancillaryinterrogators
121 git-grep mainporcelain
122 git-gui mainporcelain
123 git-hash-object plumbingmanipulators
124 git-http-fetch synchelpers
125 git-http-push synchelpers
126 git-imap-send foreignscminterface
127 git-index-pack plumbingmanipulators
128 git-init mainporcelain
129 git-instaweb ancillaryinterrogators
130 gitk mainporcelain
131 git-local-fetch synchingrepositories
132 git-log mainporcelain
133 git-lost-found ancillarymanipulators deprecated
134 git-ls-files plumbinginterrogators
135 git-ls-remote plumbinginterrogators
136 git-ls-tree plumbinginterrogators
137 git-mailinfo purehelpers
138 git-mailsplit purehelpers
139 git-merge mainporcelain
140 git-merge-base plumbinginterrogators
141 git-merge-file plumbingmanipulators
142 git-merge-index plumbingmanipulators
143 git-merge-one-file purehelpers
144 git-mergetool ancillarymanipulators
145 git-merge-tree ancillaryinterrogators
146 git-mktag plumbingmanipulators
147 git-mktree plumbingmanipulators
148 git-mv mainporcelain
149 git-name-rev plumbinginterrogators
150 git-pack-objects plumbingmanipulators
151 git-pack-redundant plumbinginterrogators
152 git-pack-refs ancillarymanipulators
153 git-parse-remote synchelpers
154 git-patch-id purehelpers
155 git-peek-remote purehelpers
156 git-prune ancillarymanipulators
157 git-prune-packed plumbingmanipulators
158 git-pull mainporcelain
159 git-push mainporcelain
160 git-quiltimport foreignscminterface
161 git-read-tree plumbingmanipulators
162 git-rebase mainporcelain
163 git-receive-pack synchelpers
164 git-reflog ancillarymanipulators
165 git-relink ancillarymanipulators
166 git-remote ancillarymanipulators
167 git-repack ancillarymanipulators
168 git-request-pull foreignscminterface
169 git-rerere ancillaryinterrogators
170 git-reset mainporcelain
171 git-revert mainporcelain
172 git-rev-list plumbinginterrogators
173 git-rev-parse ancillaryinterrogators
174 git-rm mainporcelain
175 git-runstatus ancillaryinterrogators
176 git-send-email foreignscminterface
177 git-send-pack synchingrepositories
178 git-shell synchelpers
179 git-shortlog mainporcelain
180 git-show mainporcelain
181 git-show-branch ancillaryinterrogators
182 git-show-index plumbinginterrogators
183 git-show-ref plumbinginterrogators
184 git-sh-setup purehelpers
185 git-ssh-fetch synchingrepositories
186 git-ssh-upload synchingrepositories
187 git-stash mainporcelain
188 git-status mainporcelain
189 git-stripspace purehelpers
190 git-submodule mainporcelain
191 git-svn foreignscminterface
192 git-symbolic-ref plumbingmanipulators
193 git-tag mainporcelain
194 git-tar-tree plumbinginterrogators deprecated
195 git-unpack-file plumbinginterrogators
196 git-unpack-objects plumbingmanipulators
197 git-update-index plumbingmanipulators
198 git-update-ref plumbingmanipulators
199 git-update-server-info synchingrepositories
200 git-upload-archive synchelpers
201 git-upload-pack synchelpers
202 git-var plumbinginterrogators
203 git-verify-pack plumbinginterrogators
204 git-verify-tag ancillaryinterrogators
205 git-whatchanged ancillaryinterrogators
206 git-write-tree plumbingmanipulators