zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: _stgit complete names of patches
@ 2009-05-22  8:12 Julien Langer
  0 siblings, 0 replies; only message in thread
From: Julien Langer @ 2009-05-22  8:12 UTC (permalink / raw)
  To: zsh-workers


[-- Attachment #1.1: Type: text/plain, Size: 59 bytes --]

This makes _stgit complete the names of patches.

- Julien

[-- Attachment #1.2: Type: text/html, Size: 69 bytes --]

[-- Attachment #2: stgit_complete_patchnames.patch --]
[-- Type: text/x-patch, Size: 1223 bytes --]

complete patchnames in _stgit

From: Julien Langer <julien.langer@gmail.com>


---

 Completion/Unix/Command/_stgit |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)


diff --git a/Completion/Unix/Command/_stgit b/Completion/Unix/Command/_stgit
index 69b5000..c8a3c8c 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-05-22  8:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-22  8:12 PATCH: _stgit complete names of patches Julien Langer

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