about summary refs log tree commit diff
path: root/Completion/Base
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2002-05-23 12:20:15 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2002-05-23 12:20:15 +0000
commit86f38401aacfcd9b3ef6cb54faf305f7c843e60b (patch)
tree51098b9d9f89cf1be084fb43d9def501e352b05d /Completion/Base
parent70120f22eeaa16143425bfe0071245984f7fbb61 (diff)
downloadzsh-86f38401aacfcd9b3ef6cb54faf305f7c843e60b.tar.gz
zsh-86f38401aacfcd9b3ef6cb54faf305f7c843e60b.tar.xz
zsh-86f38401aacfcd9b3ef6cb54faf305f7c843e60b.zip
for automatic long options completion, use the string after the equal signs (from the --help-text) as the description to shown when completing after the option (17214)
Diffstat (limited to 'Completion/Base')
-rw-r--r--Completion/Base/Utility/_arguments31
1 files changed, 23 insertions, 8 deletions
diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments
index b60e76342..fe8edd61a 100644
--- a/Completion/Base/Utility/_arguments
+++ b/Completion/Base/Utility/_arguments
@@ -79,7 +79,7 @@ if (( long )); then
       # Using (( ... )) gives a parse error.
 
       let "$tmpargv[(I)(|\([^\)]#\))(|\*)${opt}(|[-+]|=(|-))(|\[*\])(|:*)]" ||
-          tmp=( "$tmp[@]" "$opt" )
+          tmp=( "$tmp[@]" "$lopts[(r)$opt(|=*)]" )
     done
     lopts=( "$tmp[@]" )
 
@@ -102,7 +102,7 @@ if (( long )); then
     # makes those options be completed without an argument description.
 
     set -- "$@" '*=FILE*:file:_files' \
-           '*=(DIR|PATH)*:directory:_files -/' '*: :  '
+           '*=(DIR|PATH)*:directory:_files -/' '*=*:=: ' '*: :  '
 
     while (( $# )); do
 
@@ -136,12 +136,19 @@ if (( long )); then
       tmpo=("${(@M)tmp:#*\[\=*}")
       if (( $#tmpo )); then
         tmp=("${(@)tmp:#*\[\=*}")
-        tmpo=("${(@)${(@)tmpo%%\=*}//[^a-z0-9-]}")
 
-        if [[ "$descr" = ::* ]]; then
-	  cache=( "$cache[@]" "${(@)^tmpo}=${dir}${descr}" )
+        if [[ "$descr" = :\=* ]]; then
+          for opt in "$tmpo[@]"; do
+            cache=( "$cache[@]"
+                    "${${opt%%\=*}//[^a-zA-Z0-9-]}=::${(L)${opt%\]}#*\=}: " )
+          done
         else
-	  cache=( "$cache[@]" "${(@)^tmpo}=${dir}:${descr}" )
+          tmpo=("${(@)${(@)tmpo%%\=*}//[^a-zA-Z0-9-]}")
+          if [[ "$descr" = ::* ]]; then
+	    cache=( "$cache[@]" "${(@)^tmpo}=${dir}${descr}" )
+          else
+	    cache=( "$cache[@]" "${(@)^tmpo}=${dir}:${descr}" )
+          fi
         fi
       fi
 
@@ -150,9 +157,17 @@ if (( long )); then
       tmpo=("${(@M)tmp:#*\=*}")
       if (( $#tmpo )); then
         tmp=("${(@)tmp:#*\=*}")
-        tmpo=("${(@)${(@)tmpo%%\=*}//[^a-z0-9-]}")
 
-	cache=( "$cache[@]" "${(@)^tmpo}=${dir}${descr}" )
+        if [[ "$descr" = :\=* ]]; then
+          for opt in "$tmpo[@]"; do
+            cache=( "$cache[@]"
+                    "${${opt%%\=*}//[^a-zA-Z0-9-]}=:${(L)${opt%\]}#*\=}: " )
+          done
+        else
+          tmpo=("${(@)${(@)tmpo%%\=*}//[^a-z0-9-]}")
+
+	  cache=( "$cache[@]" "${(@)^tmpo}=${dir}${descr}" )
+        fi
       fi
 
       # Everything else is just added as an option without arguments or