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

[PATCH] Allow completions inside --{gpg,tar}-args in gpg-zip.



--gpg-args and --tar-args will complete based on values in --gpg and --tar, respectively. Also fixed return values.

Michael Hwang

---
 Completion/Unix/Command/_gpg |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/Completion/Unix/Command/_gpg b/Completion/Unix/Command/_gpg
index 3f86411..9b862cf 100644
--- a/Completion/Unix/Command/_gpg
+++ b/Completion/Unix/Command/_gpg
@@ -12,9 +12,9 @@ gpgv=('(-q --quiet)*'{-v,--verbose}'[increase amount of output]'
   '--homedir:directory:_directories')
 
 gpgzip=('--gpg[command to use instead of gpg]:command:_command'
-  '--gpg-args[gpg arguments]:gpg arguments:'
+  '--gpg-args[gpg arguments]:gpg arguments:->gpg'
   '--tar[command to use instead of tar]:command:_command'
-  '--tar-args[tar arguments]:tar arguments:'
+  '--tar-args[tar arguments]:tar arguments:->tar'
   '--list-archive[list archive contents]')
 
 gpgbasic=('(-e --encrypt)'{-e,--encrypt}'[encrypt data. this option may be combined  with --sign]'
@@ -193,15 +193,15 @@ gpgextra=('--decrypt-files[decrypt multiple files]'
 
 case "$service" in
   gpg)
-    _arguments -C -s -S -A "-*" $gpgbasic $gpgextra $gpgv '*:args:->args'
+    _arguments -C -s -S -A "-*" $gpgbasic $gpgextra $gpgv '*:args:->args' && ret=0
     ;;
 
   gpgv)
-    _arguments -C -s -S -A "-*" $gpgv '*:args:->args'
+    _arguments -C -s -S -A "-*" $gpgv '*:args:->args' && ret=0
     ;;
 
   gpg-zip)
-    _arguments -C -s -S -A "-*" $gpgbasic $gpgzip '*:args:->args'
+    _arguments -C -s -S -A "-*" $gpgbasic $gpgzip '*:args:->args' && ret=0
     ;;
 esac
 
@@ -249,6 +249,12 @@ case "$state" in
     _wanted public-keys expl 'public keyid' \
 	compadd ${${${(M)${(f)"$(_call_program public-keyids gpg $needed --list-public-keys --list-options no-show-photos 2>/dev/null)"}:%pub*}#pub */}%% *} && return
   ;;
+  (tar|gpg)
+    compset -q
+    words=( ${opt_args[--${state}]:-${state}} "$words[@]" )
+    (( CURRENT++ ))
+    _normal && return
+    ;;
 esac
 
 return ret
-- 
1.7.1.1



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