about summary refs log tree commit diff
path: root/Completion/compinit
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-12-06 17:23:04 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-12-06 17:23:04 +0000
commit8d00aca697066a70c38aa04eba19726cd8b2f3a7 (patch)
treee9e40bb6eb491f68f3e9d887c9d6dbfa968f3338 /Completion/compinit
parent32ce1cdd7978155a49c9bd85faaf3895068edebe (diff)
downloadzsh-8d00aca697066a70c38aa04eba19726cd8b2f3a7.tar.gz
zsh-8d00aca697066a70c38aa04eba19726cd8b2f3a7.tar.xz
zsh-8d00aca697066a70c38aa04eba19726cd8b2f3a7.zip
users/15621: compdef -p/-P <pat>=<service>
users/15622: use service with _pick_variant
Diffstat (limited to 'Completion/compinit')
-rw-r--r--Completion/compinit16
1 files changed, 14 insertions, 2 deletions
diff --git a/Completion/compinit b/Completion/compinit
index d85ff072e..aa42a12de 100644
--- a/Completion/compinit
+++ b/Completion/compinit
@@ -230,6 +230,10 @@ comppostfuncs=()
 
 compdef() {
   local opt autol type func delete new i ret=0 cmd svc
+  local -a match mbegin mend
+
+  emulate -L zsh
+  setopt extendedglob
 
   # Get the options.
 
@@ -364,10 +368,18 @@ compdef() {
         else
           case "$type" in
           pattern)
-            _patcomps[$1]="$func"
+	    if [[ $1 = (#b)(*)=(*) ]]; then
+	      _patcomps[$match[1]]="=$match[2]=$func"
+	    else
+	      _patcomps[$1]="$func"
+	    fi
             ;;
           postpattern)
-            _postpatcomps[$1]="$func"
+	    if [[ $1 = (#b)(*)=(*) ]]; then
+	      _postpatcomps[$match[1]]="=$match[2]=$func"
+	    else
+	      _postpatcomps[$1]="$func"
+	    fi
             ;;
           *)
             if [[ "$1" = *\=* ]]; then