]>
Commit | Line | Data |
---|---|---|
527ec398 ES |
1 | #!/usr/bin/perl |
2 | use strict; | |
3 | use warnings; | |
4 | ||
5 | print <<"EOT"; | |
6 | /* Automatically generated by $0 */ | |
7 | ||
8 | struct cmdname_help { | |
9 | char name[16]; | |
10 | char help[80]; | |
11 | unsigned char group; | |
12 | }; | |
13 | ||
14 | static char *common_cmd_groups[] = { | |
15 | EOT | |
16 | ||
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"; | |
26 | } | |
27 | ||
28 | print "};\n\nstatic struct cmdname_help common_cmds[] = {\n"; | |
29 | ||
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; | |
41 | } | |
42 | close $f; | |
43 | $cmd =~ s/^git-//; | |
44 | print "\t{\"$cmd\", N_(\"$s\"), $grp{$t}},\n"; | |
45 | last; | |
46 | } | |
47 | } | |
48 | } | |
49 | ||
50 | print "};\n"; |