zsh-workers
 help / color / mirror / code / Atom feed
From: Aaron Schrab <aaron@schrab.com>
To: Nikolai Weibull <now@bitwi.se>
Cc: zsh-workers@zsh.org
Subject: Re: _git: Add completion for help subcommand
Date: Fri, 27 Aug 2010 19:18:33 -0400	[thread overview]
Message-ID: <20100827231832.GA29397@pug.qqx.org> (raw)
In-Reply-To: <AANLkTikK9VE0ToESknTwOVdWT+d-JqNhkveDY1bSf8Ym@mail.gmail.com>

At 10:29 +0200 27 Aug 2010, Nikolai Weibull <now@bitwi.se> wrote:
>Actually, why not use
>
>- '(formats)' \,
>
>explicitly making the formats mutually exclusive?

I hadn't done that previously because as I was conceiving the issue, I 
saw the argument to specifyg the command for which help was desired as 
part of that set as well, and using that syntax would make that part of 
the mutually exclusive set.  I've now rethought that, and have moved the 
command argument into the common options, allowing use of that syntax.

Here's a revised version of the patch.

---
  Completion/Unix/Command/_git |   14 ++++++++++++++
  1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index c394e08..5fc0765 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -190,6 +190,7 @@ _git_commands () {
      'fetch:download objects and a head from another repository'
      'gc:cleanup unnecessary files and optimize the local repository'
      'grep:print lines matching a pattern'
+    'help:display help information about git subcommands'
      'init:create empty git object database'
      'log:show commit logs'
      'merge:grand unified merge driver'
@@ -490,6 +491,19 @@ _git-hash-object () {
      '(--stdin):file:_files' && ret=0
  }
  
+(( $+functions[_git-help] )) ||
+_git-help () {
+  _arguments -S \
+    ':command:_git_commands' \
+    - '(all)' \
+    '(*)'{--all,-a}'[List all available commands]' \
+    - '(format)' \
+    {--man,-m}'[Display help in man page format]' \
+    {--info,-i}'[Display help in info format]' \
+    {--web,-w}'[Display help in web browser]' \
+    && ret=0
+}
+
  (( $+functions[_git-index-pack] )) ||
  _git-index-pack () {
    local -a stdin_arguments
-- 
1.7.0.4


  reply	other threads:[~2010-08-27 23:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-21 12:21 [PATCH] " Aaron Schrab
2010-08-25 22:16 ` Nikolai Weibull
2010-08-26  3:29   ` Benjamin R. Haskell
2010-08-26  7:55     ` Nikolai Weibull
2010-08-30 16:43       ` Bart Schaefer
2010-08-30 18:59         ` Nikolai Weibull
2010-08-31  6:57           ` Bart Schaefer
2010-08-27  0:20   ` Aaron Schrab
2010-08-27  8:29     ` Nikolai Weibull
2010-08-27 23:18       ` Aaron Schrab [this message]
2010-08-27 23:43         ` Nikolai Weibull
2010-08-28  0:51           ` Aaron Schrab
2010-08-28  7:54             ` Nikolai Weibull
2010-08-28 14:16               ` Aaron Schrab
2010-08-28 14:24                 ` Nikolai Weibull
2010-12-02  0:44             ` Aaron Schrab
2010-12-04 18:10               ` Wayne Davison

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=20100827231832.GA29397@pug.qqx.org \
    --to=aaron@schrab.com \
    --cc=now@bitwi.se \
    --cc=zsh-workers@zsh.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).