On Fri, May 15, 2015 at 2:35 PM, Sébastien Guimmara <sebastien.guimmara@xxxxxxxxx> wrote: > From: Eric Sunshine <sunshine@xxxxxxxxxxxxxx> > > Parse the [common] block to create the array of group descriptions: > [...] > Signed-off-by: Eric Sunshine <sunshine@xxxxxxxxxxxxxx> > Signed-off-by: Sébastien Guimmara <sebastien.guimmara@xxxxxxxxx> > --- > diff --git a/generate-cmdlist.awk b/generate-cmdlist.awk > new file mode 100644 > index 0000000..b5cc789 > --- /dev/null > +++ b/generate-cmdlist.awk > @@ -0,0 +1,39 @@ > +BEGIN { > + print "/* Automatically generated by generate-cmdlist.awk */\n" > + print "struct cmdname_help {" > + print "\tchar name[16];" > + print "\tchar help[80];" > + print "\tunsigned char group;" > + print "};\n" > + print "static char *common_cmd_groups[] = {" > +} > +/^#/ || /^[ ]*$/ { next } > +state == 2 { > + for (i = 2; i <= NF; i++) > + if (grp[$i]) { > + f = "Documentation/"$1".txt" > + while (getline s <f > 0) > + if (match(s, $1" - ")) { > + t = substr(s, length($1" - ") + 1) > + break > + } > + close(f) > + printf "\t{\"%s\", N_(\"%s\"), %s},\n", > + substr($1, length("git-") + 1), t, grp[$i] - 1 > + break > + } > +} > +/\[commands\]/ { > + print "};\n\nstatic struct cmdname_help common_cmds[] = {" > + state = 2 > +} > +state == 1 { > + grp[$1] = ++n > + sub($1"[ ][ ]*", "") > + printf "\tN_(\"%s\"),\n", $0 > + next It probably would be best to drop this unnecessary and potentially confusing "next" line[1]. [1]: http://thread.gmane.org/gmane.comp.version-control.git/268348/focus=268599 > +} > +/\[common\]/ { > + state = 1 > +} > +END { print "};" } -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html