diff options
author | Frank Terbeck <bewater@users.sourceforge.net> | 2011-07-29 13:07:52 +0000 |
---|---|---|
committer | Frank Terbeck <bewater@users.sourceforge.net> | 2011-07-29 13:07:52 +0000 |
commit | d557905eb63f5fa087675e05ba82210c86dde358 (patch) | |
tree | e455690a3fcf74ca657fd1efa7c1aa8f7bea0f26 /Completion/Unix | |
parent | 7d1480af54e95e5a2165e8bb69937a6b0a1dc50a (diff) | |
download | zsh-d557905eb63f5fa087675e05ba82210c86dde358.tar.gz zsh-d557905eb63f5fa087675e05ba82210c86dde358.tar.xz zsh-d557905eb63f5fa087675e05ba82210c86dde358.zip |
Luka Perkov: 29624: _quilt: Improve `push' and `pop' completion.
Diffstat (limited to 'Completion/Unix')
-rw-r--r-- | Completion/Unix/Command/_quilt | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/Completion/Unix/Command/_quilt b/Completion/Unix/Command/_quilt index a2fd799a6..0c51ba5bc 100644 --- a/Completion/Unix/Command/_quilt +++ b/Completion/Unix/Command/_quilt @@ -1,5 +1,8 @@ #compdef quilt +local -a tmp +local rc + _arguments \ '--trace' \ '--quiltrc:config file:_files' \ @@ -10,21 +13,37 @@ _arguments \ '*::subcmd:->subcmd' && return 0 case "$state" in - (subcmd) + (subcmd) case "$words[1]" in (applied|delete|files|graph|header|next|previous|refresh|unapplied) - _wanted -V 'patches' expl 'patch' compadd ${(f)"$(quilt series)"} - ;; + _wanted -V 'patches' expl 'patch' compadd ${(f)"$(quilt series)"} + ;; (push) - _wanted -V 'unapplied patches' expl 'patch' compadd ${(f)"$(quilt unapplied)"} - ;; + if (( CURRENT == 2 )); then + tmp=( ${(f)"$(quilt unapplied 2>&1)"} ) + rc=$? + if (( rc == 0 )); then + _wanted -V 'unapplied patches' expl 'patch' compadd "${tmp[@]}" + else + _message "No unapplied patches" + fi + fi + ;; (pop) - _wanted -V 'applied patches' expl 'patch' compadd ${(f)"$(quilt applied)"} - ;; + if (( CURRENT == 2 )); then + tmp=( ${(f)"$(quilt applied 2>&1)"} ) + rc=$? + if (( rc == 0 )); then + _wanted -V 'applied patches' expl 'patch' compadd "${tmp[@]}" + else + _message "No applied patches" + fi + fi + ;; (*) - _files - ;; + _files + ;; esac ;; esac |