about summary refs log tree commit diff
path: root/Completion/Core
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-08-02 10:36:19 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-08-02 10:36:19 +0000
commitb2aebcad027eab3339677eb790bfa41b37c3aef0 (patch)
tree7fcd90dfce5bd5101274de338796f719fd0d89a3 /Completion/Core
parenteabfc368bd798b92f6b878430464b79de77c463f (diff)
downloadzsh-b2aebcad027eab3339677eb790bfa41b37c3aef0.tar.gz
zsh-b2aebcad027eab3339677eb790bfa41b37c3aef0.tar.xz
zsh-b2aebcad027eab3339677eb790bfa41b37c3aef0.zip
if compcontext is an assoc, the keys are the completions and the values are their descriptions (12483)
Diffstat (limited to 'Completion/Core')
-rw-r--r--Completion/Core/_complete13
1 files changed, 12 insertions, 1 deletions
diff --git a/Completion/Core/_complete b/Completion/Core/_complete
index 2441771bc..809df1fa9 100644
--- a/Completion/Core/_complete
+++ b/Completion/Core/_complete
@@ -13,11 +13,22 @@ oldcontext="$curcontext"
 
 if [[ -n "$compcontext" ]]; then
 
-  if [[ "${(t)compcontext}" = *(array|assoc)* ]]; then
+  if [[ "${(t)compcontext}" = *array* ]]; then
     local expl
 
     _wanted values expl value compadd -a - compcontext
 
+  elif [[ "${(t)compcontext}" = *assoc* ]]; then
+    local expl tmp i
+
+    tmp=()
+    for i in "${(@k)compcontext[(R)*[^[:blank:]]]}"; do
+      tmp=( "$tmp[@]" "${i}:${compcontext[$i]}" )
+    done
+    tmp=( "$tmp[@]" "${(k@)compcontext[(R)[[:blank:]]#]}" )
+
+    _describe -t values value tmp
+
   elif [[ "$compcontext" = *:*:* ]]; then
     local tag="${${compcontext%%:*}:-values}"
     local descr="${${${compcontext#${tag}:}%%:*}:-value}"