about summary refs log tree commit diff
path: root/Completion/Base/_arguments
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-09-15 14:35:16 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-09-15 14:35:16 +0000
commitbc9e764f4e9b95ec4c2a855c4118f6afb994e904 (patch)
treecba20ce3f39ef0f1916ddd3be6a7aa9250e3dc8f /Completion/Base/_arguments
parentdefa4a7fa08ba3b9020a971d189c5ded4e151d5f (diff)
downloadzsh-bc9e764f4e9b95ec4c2a855c4118f6afb994e904.tar.gz
zsh-bc9e764f4e9b95ec4c2a855c4118f6afb994e904.tar.xz
zsh-bc9e764f4e9b95ec4c2a855c4118f6afb994e904.zip
zsh-workers/7844
Diffstat (limited to 'Completion/Base/_arguments')
-rw-r--r--Completion/Base/_arguments73
1 files changed, 21 insertions, 52 deletions
diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments
index a8e272cac..df01ba6a4 100644
--- a/Completion/Base/_arguments
+++ b/Completion/Base/_arguments
@@ -8,7 +8,7 @@ setopt localoptions extendedglob
 local args rest ws cur nth def nm expl descr action opt arg tmp xor
 local single uns ret=1 aret soptseq soptseq1 sopts prefix _line odescr
 local beg optbeg argbeg nargbeg inopt inrest fromrest cmd="$words[1]"
-local matched curopt noargs i
+local matched curopt noargs i tmp1 tmp2 tmp3 suffix
 
 # Associative arrays used to collect information about the options.
 
@@ -793,13 +793,8 @@ while true; do
 
         eval ws\=\( "${action[3,-3]}" \)
 
-	if [[ -n "$compconfig[describe_values]" &&
-              "$compconfig[describe_values]" != *\!${cmd}* ]] &&
-           _display tmp "$ws[@]"; then
-	  compadd "$expl[@]" -M 'r:|[_-]=* r:|=*' -ld tmp - "${(@)ws%%:*}"
-        else
-	  compadd "$expl[@]" - "${(@)ws%%:*}"
-        fi
+        _describe -c "$cmd" "$descr" ws -M 'r:|[_-]=* r:|=*'
+
       elif [[ "$action" = \(*\) ]]; then
 
         # Anything inside `(...)' is added directly.
@@ -837,62 +832,36 @@ while true; do
     if [[ -n "$sopts" && -n "$PREFIX" &&
       "$PREFIX" = [-+]${~soptseq}[$sopts] ]]; then
       if [[ "$PREFIX" = [-+]${~soptseq1} ]]; then
-        if [[ -z "$compconfig[describe_options]" ||
-              "$compconfig[describe_options]" = *\!${cmd}* ]]; then
-          tmp=( "${PREFIX[1]}${(@)^${(@)${(@M)${=:-${(k)opts} ${(k)dopts} ${(k)odopts}}:#[-+]?(|=)}#?}%=}" )
-          compadd "$expl[@]" -Q -M 'r:|[_-]=* r:|=*' -d tmp - \
-                "${PREFIX}${(@k)^opts[(I)${PREFIX[1]}?]#?}" \
-	        "${PREFIX}${(@k)^dopts[(I)${PREFIX[1]}?]#?}" \
-	        "${PREFIX}${(@)^${(@k)odopts[(I)${PREFIX[1]}?(|=)]#?}%=}" && 
-              ret=0
-        elif _display tmp "${(@Mo)odescr:#[-+]?:*}"; then
-          compadd "$expl[@]" -Q -M 'r:|[_-]=* r:|=*' -ld tmp - \
-	          "${PREFIX}${(@)^${(@)${(@Mo)odescr:#[-+]?:*}%%:*}#?}" && ret=0
-        else
-          compadd "$expl[@]" -Q -M 'r:|[_-]=* r:|=*' -d tmp - \
-	          "${PREFIX}${(@)^${(@)${(@Mo)odescr:#[-+]?:*}%%:*}#?}" && ret=0
-        fi
+        tmp1=( "${(@Mo)odescr:#[-+]?:*}" )
+        tmp2=(
+               "${PREFIX}${(@k)^opts[(I)${PREFIX[1]}?]#?}" \
+	       "${PREFIX}${(@k)^dopts[(I)${PREFIX[1]}?]#?}" \
+	       "${PREFIX}${(@)^${(@k)odopts[(I)${PREFIX[1]}?(|=)]#?}%=}"
+        )
+        tmp2=( "${(@o)tmp2}" )
+
+        _describe -o -c "$cmd" option \
+        tmp1 tmp2  -Q -M 'r:|[_-]=* r:|=*'
       else
         # The last option takes an argument in the next word.
 
         compadd "$expl[@]" -Q -M 'r:|[_-]=* r:|=*' - "${PREFIX}" && ret=0
       fi
     else
-      if [[ -n "$compconfig[describe_options]" &&
-            "$compconfig[describe_options]" != *\!${cmd}* ]] &&
-	 _display descr "$odescr[@]"; then
-	ws=( "${(k)opts[@]}" "${(@k)odopts[(I)*[^=]]}" )
-	if (( $#ws )); then
-	  tmp=( "${(@M)descr:#(${(j:|:)~ws}) *}" )
-          compadd "$expl[@]" -Q -M 'r:|[_-]=* r:|=*' -ld tmp - \
-                  "$ws[@]" && ret=0
-	fi
-	if (( $#dopts )); then
-	  tmp=( "${(@M)descr:#(${(kj:|:)~dopts}) *}" )
-          compadd "$expl[@]" -QS '' -M 'r:|[_-]=* r:|=*' -ld tmp - \
-                  "${(@k)dopts}" && ret=0
-        fi
-	if (( ${(@k)#odopts[(I)*=]} )); then
-	  tmp=( "${(@M)descr:#(${(kj:|:)~odopts[(I)*=]}) *}" )
-          compadd "$expl[@]" -QqS= -M 'r:|[_-]=* r:|=*' -ld tmp - \
-                  "${(@k)odopts[(I)*=]%=}" && ret=0
-        fi
-      else
-        compadd "$expl[@]" -Q -M 'r:|[_-]=* r:|=*' - \
-                "${(@k)opts}" "${(@k)odopts[(I)*[^=]]}" && ret=0
-        compadd "$expl[@]" -QqS= -M 'r:|[_-]=* r:|=*' - \
-                "${(@k)odopts[(I)*=]%=}" && ret=0
-        compadd "$expl[@]" -QS '' -M 'r:|[_-]=* r:|=*' - \
-                "${(@k)dopts}" && ret=0
-      fi
+      tmp1=( "${(k)opts[@]}" "${(@k)odopts[(I)*[^=]]}" )
+      tmp1=( "${(@M)odescr:#(${(kj:|:)~tmp1}):*}" )
+      tmp2=( "${(@M)odescr:#(${(kj:|:)~dopts}):*}" )
+      tmp3=( "${(@M)odescr:#(${(kj:|:)~odopts[(I)*=]}):*}" )
+      _describe -o -c "$cmd" option \
+        tmp1 -Q -M 'r:|[_-]=* r:|=*' -- \
+        tmp2 -QS '' -M 'r:|[_-]=* r:|=*' -- \
+        tmp3 -QqS= -M 'r:|[_-]=* r:|=*'
     fi
   fi
 
   if [[ nm -eq compstate[nmatches] && 
         ( -z "$single" ||
           ( $#_args_cache_long -ne 0 && "$PREFIX" = --*=* ) ) ]]; then
-    local suffix
-
     tmp=( "${(@Mk)odopts:#[^:]#\=}" )
     prefix="${PREFIX#*\=}"
     suffix="$SUFFIX"