summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Base/Utility/_arguments31
2 files changed, 28 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 2139dcb3b..5e17440ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2002-05-23 Sven Wischnowsky <wischnow@zsh.org>
+ * 17214: Completion/Base/Utility/_arguments: 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
+
* 17213: Completion/Base/Utility/_describe,
Completion/Zsh/Command/_zstyle, Doc/Zsh/compsys.yo: rename
max-match-length style to max-matches-width
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