Re: [PATCH] bash-completion: Add non-command git help files to bash-completion

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Junio C Hamano <gitster@...>
Cc: Marcus Griep <marcus@...>, Git Mailing List <git@...>, Shawn O. Pearce <spearce@...>
Date: Friday, August 15, 2008 - 4:32 pm

On 15 aug 2008, at 20:50, Junio C Hamano wrote:


How about something simple like this?

diff --git a/builtin-help.c b/builtin-help.c
index 391f749..a49b5c2 100644
--- a/builtin-help.c
+++ b/builtin-help.c
@@ -446,6 +446,11 @@ int cmd_help(int argc, const char **argv, const  
char *prefix)
                 return 0;
         }

+       if (!strcmp("man-path", argv[0])) {
+               printf("%s\n", GIT_MAN_PATH);
+               return 0;
+       }
+
         switch (help_format) {
         case HELP_FORMAT_MAN:
                 show_man_page(argv[0]);
diff --git a/contrib/completion/git-completion.bash b/contrib/ 
completion/git-completion.bash
index 3396e35..f781661 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -885,7 +885,8 @@ _git_help ()
                 return
                 ;;
         esac
-       __gitcomp "$(__git_all_commands)"
+       __gitcomp "$(ls $(./git help man-path)/man?/* |
+         sed -n 's/^.*\/git-\{0,1\}\(.*\)\.[0-9]$/\1/p')"
  }

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] bash-completion: Add non-command git help files ..., Pieter de Bie, (Fri Aug 15, 4:32 pm)