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

patch: completion for stgit `--patch` option



Here is a patch adding completion support for stgit `--patch` option.

With the patch applied I get:
$ stg ser
+ bar_feature
> foo_feature

$ stg refresh --patch bar_feature
 -- patch --
bar_feature  foo_feature

If that is of any interest, what's the process to get this in?

Cheers,

Alexandre
commit 8e7f84ddda81280812a5082ff82209c30928b17e
Author: Alexandre Rames <alexandre.rames@xxxxxxx>
Date:   Thu Sep 4 15:21:39 2014 +0100

    Add completion for stgit `--patch` option.

diff --git a/Completion/Unix/Command/_stgit b/Completion/Unix/Command/_stgit
index b2f2aea..6248267 100644
--- a/Completion/Unix/Command/_stgit
+++ b/Completion/Unix/Command/_stgit
@@ -32,6 +32,17 @@ else
 	compadd $(stg series --noprefix 2> /dev/null) \
 		&& ret=0
     ;;
+    (ref*)
+      last_word="$words[$CURRENT-1]"
+      refresh_patch_options=( -p --patch )
+      if [[ -n ${refresh_patch_options[(r)$last_word]} ]]; then
+	_wanted -V "applied patches" expl "patch" \
+	  compadd ${${(M)${(f)"$(stg series 2> /dev/null)"}##[+>] *}#[+>] } \
+		  && ret=0
+      else
+	_files
+      fi
+    ;;
     (*)
       _files
     ;;


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