refs.c: avoid repeated git_path calls in rename_tmp_log
[git.git] / generate-cmdlist.perl
blob31516e36ace57e4f46b83e4a6d2cc30cc76324cc
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
5 print <<"EOT";
6 /* Automatically generated by $0 */
8 struct cmdname_help {
9 char name[16];
10 char help[80];
11 unsigned char group;
14 static char *common_cmd_groups[] = {
15 EOT
17 my $n = 0;
18 my %grp;
19 while (<>) {
20 last if /^### command list/;
21 next if (1../^### common groups/) || /^#/ || /^\s*$/;
22 chop;
23 my ($k, $v) = split ' ', $_, 2;
24 $grp{$k} = $n++;
25 print "\tN_(\"$v\"),\n";
28 print "};\n\nstatic struct cmdname_help common_cmds[] = {\n";
30 while (<>) {
31 next if /^#/ || /^\s*$/;
32 my @tags = split;
33 my $cmd = shift @tags;
34 for my $t (@tags) {
35 if (exists $grp{$t}) {
36 my $s;
37 open my $f, '<', "Documentation/$cmd.txt" or die;
38 while (<$f>) {
39 ($s) = /^$cmd - (.+)$/;
40 last if $s;
42 close $f;
43 $cmd =~ s/^git-//;
44 print "\t{\"$cmd\", N_(\"$s\"), $grp{$t}},\n";
45 last;
50 print "};\n";