13 # Ignore comments and allow empty lines
17 case "$exclude_programs" in
36 define_categories
() {
38 echo "/* Command categories */"
43 echo "#define CAT_$cat (1UL << $bit)"
46 test "$bit" -gt 32 && die
"Urgh.. too many categories?"
49 define_category_names
() {
51 echo "/* Category names */"
52 echo "static const char *category_names[] = {"
57 echo " \"$cat\", /* (1UL << $bit) */"
64 print_command_list
() {
65 echo "static struct cmdname_help command_list[] = {"
75 synopsis
=${line#$cmd - }
79 done <"$1/Documentation/$cmd.adoc"
81 printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis"
82 printf " | CAT_%s" $rest
89 while test "--exclude-program" = "$1"
92 exclude_programs
="$exclude_programs$1:"
98 die
"USAGE: $0 <SOURCE_DIR> <OUTPUT>"
105 commands
="$(command_list "$SOURCE_DIR"/command-list.txt)"
106 categories
="$(category_list "$commands")"
108 echo "/* Automatically generated by generate-cmdlist.sh */
109 struct cmdname_help {
115 define_categories
"$categories"
117 define_category_names
"$categories"
119 print_command_list
"$SOURCE_DIR" "$commands"