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>
eval "grep -ve '^#' $exclude_programs" <"$1"
}
-get_categories () {
+get_category_line () {
tr ' ' '\012' |
LC_ALL=C sort -u
}
category_list () {
command_list "$1" |
cut -c 40- |
- get_categories |
+ tr ' ' '\012' |
+ LC_ALL=C sort -u |
grep -v '^$'
}
while read cmd rest
do
printf " { \"$cmd\", $(get_synopsis $cmd), 0"
- for cat in $(echo "$rest" | get_categories)
+ for cat in $(echo "$rest" | get_category_line)
do
printf " | CAT_$cat"
done