generate-cmdlist.perlon commit builtin-am: implement --ignore-date (f07adb6)
   1#!/usr/bin/perl
   2use strict;
   3use warnings;
   4
   5print <<"EOT";
   6/* Automatically generated by $0 */
   7
   8struct cmdname_help {
   9        char name[16];
  10        char help[80];
  11        unsigned char group;
  12};
  13
  14static char *common_cmd_groups[] = {
  15EOT
  16
  17my $n = 0;
  18my %grp;
  19while (<>) {
  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
  28print "};\n\nstatic struct cmdname_help common_cmds[] = {\n";
  29
  30while (<>) {
  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
  50print "};\n";