git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Basic Zsh completion support
@ 2006-03-18 14:53 Fredrik Kuivinen
  2006-03-18 15:25 ` Nikolai Weibull
  0 siblings, 1 reply; 5+ messages in thread
From: Fredrik Kuivinen @ 2006-03-18 14:53 UTC (permalink / raw)
  To: git; +Cc: junkio


Based on the completion code for quilt in the Zsh distribution.

Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>

---

 .gitignore            |    1 +
 Makefile              |    8 +++++++-
 generate-zsh-compl.sh |   26 ++++++++++++++++++++++++++
 3 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/.gitignore b/.gitignore
index b4355b9..1cf6ac0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -133,3 +133,4 @@ libgit.a
 *.py[co]
 config.mak
 git-blame
+_git
diff --git a/Makefile b/Makefile
index 8a20c76..85c5e2d 100644
--- a/Makefile
+++ b/Makefile
@@ -96,6 +96,7 @@ bindir = $(prefix)/bin
 gitexecdir = $(bindir)
 template_dir = $(prefix)/share/git-core/templates/
 GIT_PYTHON_DIR = $(prefix)/share/git-core/python
+ZSH_COMPL_DIR = $(prefix)/share/zsh/site-functions
 # DESTDIR=
 
 CC = gcc
@@ -438,13 +439,14 @@ SHELL_PATH_SQ = $(subst ','\'',$(SHELL_P
 PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
 PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
 GIT_PYTHON_DIR_SQ = $(subst ','\'',$(GIT_PYTHON_DIR))
+ZSH_COMPL_DIR_SQ = $(subst ','\'',$(ZSH_COMPL_DIR))
 
 ALL_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' $(COMPAT_CFLAGS)
 LIB_OBJS += $(COMPAT_OBJS)
 export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir
 ### Build rules
 
-all: $(ALL_PROGRAMS) git$X gitk
+all: $(ALL_PROGRAMS) git$X gitk _git
 
 all:
 	$(MAKE) -C templates
@@ -553,6 +555,8 @@ $(LIB_FILE): $(LIB_OBJS)
 doc:
 	$(MAKE) -C Documentation all
 
+_git: generate-zsh-compl.sh
+	./generate-zsh-compl.sh version help $(ALL_PROGRAMS) > _git
 
 ### Testing rules
 
@@ -586,6 +590,8 @@ install: all
 	$(MAKE) -C templates install
 	$(INSTALL) -d -m755 '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)'
 	$(INSTALL) $(PYMODULES) '$(DESTDIR_SQ)$(GIT_PYTHON_DIR_SQ)'
+	$(INSTALL) -d -m755 $(ZSH_COMPL_DIR)
+	$(INSTALL) -m644 _git '$(DESTDIR_SQ)$(ZSH_COMPL_DIR_SQ)'
 
 install-doc:
 	$(MAKE) -C Documentation install
diff --git a/generate-zsh-compl.sh b/generate-zsh-compl.sh
new file mode 100755
index 0000000..f8c80de
--- /dev/null
+++ b/generate-zsh-compl.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+cmds=$(echo "$@" | sed s/git-//g | sed "s/\\.[^ ]*//g")
+
+cat <<EOF
+#compdef git
+
+# Automatically generated by $0
+
+local _git_subcommands expl curcontext="$curcontext"
+
+_arguments \
+  '--version' \
+  '--exec-path=:Git exec path:_path_files' \
+  '--help' \
+  '*::git command:->subcmd' && return 0
+
+ _git_subcommands=($cmds)
+
+if (( CURRENT == 1 )); then
+  _describe -t subcommand 'subcommand' _git_subcommands
+else
+  # this part should be tailored for subcmds
+  _files
+fi
+EOF

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Basic Zsh completion support
  2006-03-18 14:53 [PATCH] Basic Zsh completion support Fredrik Kuivinen
@ 2006-03-18 15:25 ` Nikolai Weibull
  2006-03-18 15:52   ` Bertrand Jacquin
  2006-03-18 16:23   ` Fredrik Kuivinen
  0 siblings, 2 replies; 5+ messages in thread
From: Nikolai Weibull @ 2006-03-18 15:25 UTC (permalink / raw)
  To: Fredrik Kuivinen; +Cc: git, junkio

On 3/18/06, Fredrik Kuivinen <freku045@student.liu.se> wrote:
>
> Based on the completion code for quilt in the Zsh distribution.

Actually, there's an almost-complete implementation in 4.3 already. 
Written by me nonetheless.  You can take a look and make suggestions
if you like :-).  I have an updated version to deal with post
1.0-changes locally that I'm going to put in Zsh's CVS soon enough.

  nikolai

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Basic Zsh completion support
  2006-03-18 15:25 ` Nikolai Weibull
@ 2006-03-18 15:52   ` Bertrand Jacquin
  2006-03-18 16:14     ` Nikolai Weibull
  2006-03-18 16:23   ` Fredrik Kuivinen
  1 sibling, 1 reply; 5+ messages in thread
From: Bertrand Jacquin @ 2006-03-18 15:52 UTC (permalink / raw)
  To: Nikolai Weibull; +Cc: Fredrik Kuivinen, git, junkio

On 3/18/06, Nikolai Weibull <now@bitwi.se> wrote:
> On 3/18/06, Fredrik Kuivinen <freku045@student.liu.se> wrote:
> >
> > Based on the completion code for quilt in the Zsh distribution.
>
> Actually, there's an almost-complete implementation in 4.3 already.
> Written by me nonetheless.  You can take a look and make suggestions
> if you like :-).  I have an updated version to deal with post
> 1.0-changes locally that I'm going to put in Zsh's CVS soon enough.

Any plan do to this for cogito ?

>
>   nikolai
> -
> 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
>


--
Beber
#e.fr@freenode

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Basic Zsh completion support
  2006-03-18 15:52   ` Bertrand Jacquin
@ 2006-03-18 16:14     ` Nikolai Weibull
  0 siblings, 0 replies; 5+ messages in thread
From: Nikolai Weibull @ 2006-03-18 16:14 UTC (permalink / raw)
  To: Bertrand Jacquin; +Cc: Fredrik Kuivinen, git, junkio

On 3/18/06, Bertrand Jacquin <beber.mailing@gmail.com> wrote:
> On 3/18/06, Nikolai Weibull <now@bitwi.se> wrote:
> > On 3/18/06, Fredrik Kuivinen <freku045@student.liu.se> wrote:
> > >
> > > Based on the completion code for quilt in the Zsh distribution.
> >
> > Actually, there's an almost-complete implementation in 4.3 already.
> > Written by me nonetheless.  You can take a look and make suggestions
> > if you like :-).  I have an updated version to deal with post
> > 1.0-changes locally that I'm going to put in Zsh's CVS soon enough.
>
> Any plan do to this for cogito ?

Sure, and stgit as well, but I haven't gotten around to it.  The idea
was to reuse as much as possible of the stuff that the three have in
common (like tags, references, and so on), but as I haven't used
either of the two (cogito and stgit) I haven't had a compelling reason
to sit down and do it.

  nikolai

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Basic Zsh completion support
  2006-03-18 15:25 ` Nikolai Weibull
  2006-03-18 15:52   ` Bertrand Jacquin
@ 2006-03-18 16:23   ` Fredrik Kuivinen
  1 sibling, 0 replies; 5+ messages in thread
From: Fredrik Kuivinen @ 2006-03-18 16:23 UTC (permalink / raw)
  To: Nikolai Weibull; +Cc: Fredrik Kuivinen, git, junkio

On Sat, Mar 18, 2006 at 04:25:04PM +0100, Nikolai Weibull wrote:
> On 3/18/06, Fredrik Kuivinen <freku045@student.liu.se> wrote:
> >
> > Based on the completion code for quilt in the Zsh distribution.
> 
> Actually, there's an almost-complete implementation in 4.3 already. 
> Written by me nonetheless.  You can take a look and make suggestions
> if you like :-).  I have an updated version to deal with post
> 1.0-changes locally that I'm going to put in Zsh's CVS soon enough.
> 

Oh, I didn't know about that.

<updates zsh>

Very nice! Much better than my crude cut-and-paste work.


Junio: Please don't apply the patch.

- Fredrik

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-03-18 16:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-18 14:53 [PATCH] Basic Zsh completion support Fredrik Kuivinen
2006-03-18 15:25 ` Nikolai Weibull
2006-03-18 15:52   ` Bertrand Jacquin
2006-03-18 16:14     ` Nikolai Weibull
2006-03-18 16:23   ` Fredrik Kuivinen

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