diff options
Diffstat (limited to 'generate-cmdlist.sh')
-rwxr-xr-x | generate-cmdlist.sh | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh index cfe0454d1d..205541e0f7 100755 --- a/generate-cmdlist.sh +++ b/generate-cmdlist.sh @@ -26,7 +26,7 @@ command_list () { } category_list () { - command_list "$1" | + echo "$1" | cut -d' ' -f2- | tr ' ' '\012' | grep -v '^$' | @@ -37,7 +37,7 @@ define_categories () { echo echo "/* Command categories */" bit=0 - category_list "$1" | + echo "$1" | while read cat do echo "#define CAT_$cat (1UL << $bit)" @@ -51,7 +51,7 @@ define_category_names () { echo "/* Category names */" echo "static const char *category_names[] = {" bit=0 - category_list "$1" | + echo "$1" | while read cat do echo " \"$cat\", /* (1UL << $bit) */" @@ -64,7 +64,7 @@ define_category_names () { print_command_list () { echo "static struct cmdname_help command_list[] = {" - command_list "$1" | + echo "$1" | while read cmd rest do synopsis= @@ -93,6 +93,9 @@ do shift done +commands="$(command_list "$1")" +categories="$(category_list "$commands")" + echo "/* Automatically generated by generate-cmdlist.sh */ struct cmdname_help { const char *name; @@ -100,8 +103,8 @@ struct cmdname_help { uint32_t category; }; " -define_categories "$1" +define_categories "$categories" echo -define_category_names "$1" +define_category_names "$categories" echo -print_command_list "$1" +print_command_list "$commands" |