From 1b81d8cb19d8da6d865b7fca5a095dd5fec8d209 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Sun, 20 May 2018 20:40:02 +0200 Subject: help: use command-list.txt for the source of guides MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'contrib/completion/git-completion.bash') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 62ca8641f4..4e724a5b76 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -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 " } -- cgit v1.3