From a1d6616455d68a07d009bc538355970826625f7a Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 22 May 2009 20:13:17 +0000 Subject: Julien Langer: 26978: stgit patch name completion --- Completion/Unix/Command/_stgit | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command/_stgit') 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 -- cgit v1.2.3