diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2021-11-05 15:08:02 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-11-05 12:01:12 -0700 |
commit | 0f05f22516ac8208452e1f2989dfd9adfbb70c3a (patch) | |
tree | 3064a02419dc971184b6b0c4f301445e9c3bb1dd | |
parent | generate-cmdlist.sh: spawn fewer processes (diff) | |
download | tgif-0f05f22516ac8208452e1f2989dfd9adfbb70c3a.tar.xz |
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>
-rwxr-xr-x | generate-cmdlist.sh | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh index 2736791561..16043e3847 100755 --- a/generate-cmdlist.sh +++ b/generate-cmdlist.sh @@ -9,7 +9,7 @@ command_list () { eval "grep -ve '^#' $exclude_programs" <"$1" } -get_categories () { +get_category_line () { tr ' ' '\012' | LC_ALL=C sort -u } @@ -17,7 +17,8 @@ get_categories () { category_list () { command_list "$1" | cut -c 40- | - get_categories | + tr ' ' '\012' | + LC_ALL=C sort -u | grep -v '^$' } @@ -66,7 +67,7 @@ print_command_list () { 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 |