From b2aebcad027eab3339677eb790bfa41b37c3aef0 Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Wed, 2 Aug 2000 10:36:19 +0000 Subject: if compcontext is an assoc, the keys are the completions and the values are their descriptions (12483) --- Completion/Core/_complete | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'Completion/Core/_complete') 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}" -- cgit 1.4.1