help: use command-list.txt for the source of guides

The help command currently hard codes the list of guides and their
summary in C. Let's move this list to command-list.txt. This lets us
extract summary lines from Documentation/git*.txt. This also
potentially lets us list guides in git.txt, but I'll leave that for
now.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy
2018-05-20 20:40:02 +02:00
committed by Junio C Hamano
parent 63eae83f8f
commit 1b81d8cb19
10 changed files with 54 additions and 45 deletions

View File

@ -1575,6 +1575,13 @@ _git_grep ()
__git_complete_refs
}
__git_all_guides=
__git_compute_all_guides ()
{
test -n "$__git_all_guides" ||
__git_all_guides=$(git --list-cmds=list-guide)
}
_git_help ()
{
case "$cur" in
@ -1584,11 +1591,9 @@ _git_help ()
;;
esac
__git_compute_all_commands
__gitcomp "$__git_all_commands $(__git_aliases)
attributes cli core-tutorial cvs-migration
diffcore everyday gitk glossary hooks ignore modules
namespaces repository-layout revisions tutorial tutorial-2
workflows
__git_compute_all_guides
__gitcomp "$__git_all_commands $(__git_aliases) $__git_all_guides
gitk
"
}