mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-11-19 13:33:52 +01:00
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)
This commit is contained in:
parent
70120f22ee
commit
86f38401aa
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user