Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: _git: Add completion for help subcommand



At 00:16 +0200 26 Aug 2010, Nikolai Weibull <now@xxxxxxxx> wrote:
On Sat, Aug 21, 2010 at 14:21, Aaron Schrab <aaron@xxxxxxxxxx> wrote:

Seems fine except for this:

+ Âlocal formats='(--info -i --man -m --web -w)'

Although this is sort of nice it doesnât follow the style of this or
other completion files, so please write out the whole list in each
line.

I think that results in unnecessary duplication, but I guess the list isn't big enough or likely to change often enough for that to be a major issue.

So here's a version with the requested modification.

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

diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index c394e08..bccd43a 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,18 @@ _git-hash-object () {
    '(--stdin):file:_files' && ret=0
}

+(( $+functions[_git-help] )) ||
+_git-help () {
+  _arguments -S \
+    - '(all)' \
+    {--all,-a}'[List all available commands]' \
+    - 'format' \
+    "(--info -i --man -m --web -w)"{--man,-m}'[Display help in man page format]' \
+    "(--info -i --man -m --web -w)"{--info,-i}'[Display help in info format]' \
+    "(--info -i --man -m --web -w)"{--web,-w}'[Display help in web browser]' \
+    ':command:_git_commands' && ret=0
+}
+
(( $+functions[_git-index-pack] )) ||
_git-index-pack () {
  local -a stdin_arguments
--
1.7.1



Messages sorted by: Reverse Date, Date, Thread, Author