generate-cmdlist.sh: don't call get_categories() from category_list()

This isn't for optimization as the get_categories() is a purely shell function, but rather for ease of readability, let's just inline these two lines. We'll be changing this code some more in subsequent commits to make this worth it. Rename the get_categories() function to get_category_line(), since that's what it's doing now. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Nov 5, 2021 at 15:08 UTC 0f05f22516ac8208452e1f2989dfd9adfbb70c3a
1 file changed +4 -3
generate-cmdlist.sh
+4 -3
@@ -9,7 +9,7 @@ command_list () {
9 eval "grep -ve '^#' $exclude_programs" <"$1"
10 }
11
12 -get_categories () {
12 +get_category_line () {
13 tr ' ' '\012' |
14 LC_ALL=C sort -u
15 }
@@ -17,7 +17,8 @@ get_categories () {
17 category_list () {
18 command_list "$1" |
19 cut -c 40- |
20 - get_categories |
20 + tr ' ' '\012' |
21 + LC_ALL=C sort -u |
22 grep -v '^$'
23 }
24
@@ -66,7 +67,7 @@ print_command_list () {
67 while read cmd rest
68 do
69 printf " { \"$cmd\", $(get_synopsis $cmd), 0"
69 - for cat in $(echo "$rest" | get_categories)
70 + for cat in $(echo "$rest" | get_category_line)
71 do
72 printf " | CAT_$cat"
73 done