#!/bin/sh

echo "/* Automatically generated by $0 */
struct cmdname_help
{
    char name[16];
    char help[80];
};

static struct cmdname_help common_cmds[] = {"

sed -n 's/^lkvm-\([^ \t]*\).*common/\1/p' command-list.txt |
while read cmd
do
	 # TODO following sed command should be fixed
     sed -n '/^NAME/,/^lkvm-'"$cmd"'/ {
		 /NAME/d
		 /--/d
		 s/.*kvm-'"$cmd"' - \(.*\)/  {"'"$cmd"'", "\1"},/
	     p
	 }' "Documentation/kvm-$cmd.txt"
done
echo "};"
