summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-05-22 20:13:17 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-05-22 20:13:17 +0000
commita1d6616455d68a07d009bc538355970826625f7a (patch)
tree9ede55c21d21b19e032b04eec8d5eece238bf946
parentf359213eec1dcd2a60b31e6a377328cbc6b3cbd8 (diff)
downloadzsh-a1d6616455d68a07d009bc538355970826625f7a.tar.gz
zsh-a1d6616455d68a07d009bc538355970826625f7a.tar.xz
zsh-a1d6616455d68a07d009bc538355970826625f7a.zip
Julien Langer: 26978: stgit patch name completion
-rw-r--r--ChangeLog7
-rw-r--r--Completion/Unix/Command/_stgit29
2 files changed, 33 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 8d4d6cc59..9dc230fc6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-22  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 26978: Julien Langer: Completion/Unix/Command/_stgit: complete
+	patch names.
+
 2009-05-22  Peter Stephenson  <pws@csr.com>
 
 	* 26982: Julien Langer: Doc/Zsh/contrib.yo,
@@ -11756,5 +11761,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4696 $
+* $Revision: 1.4697 $
 *****************************************************
diff --git a/Completion/Unix/Command/_stgit b/Completion/Unix/Command/_stgit
index 69b50004c..c8a3c8c80 100644
--- a/Completion/Unix/Command/_stgit
+++ b/Completion/Unix/Command/_stgit
@@ -50,8 +50,33 @@ subcmds=(
   'status:show the tree status'
 )
 
+local curcontext="$curcontext"
+local subcmd
+local ret=1
+
 if (( CURRENT == 2 )); then
-  _describe -t commands 'stgit command' subcmds
+  _describe -t commands 'stgit command' subcmds && ret=0
 else
-  _files
+  shift words
+  (( CURRENT-- ))
+  subcmd="$words[1]"
+  curcontext="${curcontext%:*}-${subcmd}:"
+
+  case $subcmd in
+    (push)
+      _wanted -V "unapplied patches" expl "patch" compadd $(stg unapplied) \
+		&& ret=0
+    ;;
+    (pop)
+      _wanted -V "applied patches" expl "patch" compadd $(stg applied) && ret=0
+    ;;
+    (edit|files|goto|rename|log|float|delete|sink|mail|sync|show|pick|hide)
+      _wanted -V "patches" expl "patch" compadd $(stg series --noprefix) && ret=0
+    ;;
+    (*)
+      _files
+    ;;
+  esac
 fi
+
+return ret