git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcus Griep <marcus@griep.us>
To: Pieter de Bie <pdebie@ai.rug.nl>
Cc: Junio C Hamano <gitster@pobox.com>,
	Git Mailing List <git@vger.kernel.org>,
	"Shawn O. Pearce" <spearce@spearce.org>
Subject: Re: [PATCH] bash-completion: Add non-command git help files to bash-completion
Date: Fri, 15 Aug 2008 17:17:25 -0400	[thread overview]
Message-ID: <48A5F265.5080905@griep.us> (raw)
In-Reply-To: <B03ECD53-5920-4750-816F-890980C4CBD6@ai.rug.nl>

Pieter de Bie wrote:
> How about something simple like this?

Seems to do the job.

> diff --git a/builtin-help.c b/builtin-help.c

Are you working on next? Even though I know next is the new
master. (master is soooo nearly last week. :-P)

I had a slightly different take.  Your completion creates a 'k'
for gitk, which was suggested earlier in the thread suggested 
is a bit harder to grok.  This promotes 'git?' commands to use
'git?' rather than '?' without affecting things otherwise.
---
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index c0bf7aa..0bb0d79 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -885,7 +885,9 @@ _git_help ()
                return
                ;;
        esac
-       __gitcomp "$(__git_all_commands)"
+       __gitcomp "$(ls $(./git help man-path)/man?/* |
+               sed -n -e 's/^.*\/git-\?\(.\{2,\}\)\.[0-9]$/\1/p' \
+                       -e 's/^.*\/git\(.\)\.[0-9]$/git\1/p')"
 }

 _git_init ()
diff --git a/help.c b/help.c
index 3cb1962..d0416e1 100644
--- a/help.c
+++ b/help.c
@@ -717,6 +717,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]);
---

What do you think, Junio?  If it works, I'll make this a
normal patch submission.

-- 
Marcus Griep
GPG Key ID: 0x5E968152
——
http://www.boohaunt.net
את.ψο´

      reply	other threads:[~2008-08-15 21:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-15 16:15 [PATCH] bash-completion: Add non-command git help files to bash-completion Marcus Griep
2008-08-15 17:38 ` Jonathan Nieder
2008-08-15 17:53   ` Marcus Griep
2008-08-15 17:59 ` [PATCH v2] " Marcus Griep
2008-08-15 18:00   ` Shawn O. Pearce
2008-08-16  9:30     ` Junio C Hamano
2008-08-15 18:21 ` [PATCH] " Junio C Hamano
2008-08-15 18:33   ` Marcus Griep
2008-08-15 18:50     ` Junio C Hamano
2008-08-15 19:03       ` Marcus Griep
2008-08-15 20:32       ` Pieter de Bie
2008-08-15 21:17         ` Marcus Griep [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48A5F265.5080905@griep.us \
    --to=marcus@griep.us \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pdebie@ai.rug.nl \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).