1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-15 21:43:09 +01:00

40332: completion for new autoload features

This commit is contained in:
Peter Stephenson 2017-01-11 21:23:34 +00:00
parent b6082cd1e2
commit 12100eb6b9
2 changed files with 21 additions and 8 deletions

@ -1,3 +1,8 @@
2017-01-11 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 40332: Completion/Zsh/Command/_typeset: completion for new
autoload features.
2017-01-11 Oliver Kiddle <opk@zsh.org>
* 40321: Doc/Zsh/compsys.yo, Src/Zle/computil.c,

@ -21,6 +21,7 @@ allargs=(
X '+X[immediately autoload function]'
Z "($fopts -A -E -F -i)-Z+[right justify and fill with leading zeros]:width"
a "($fopts -A -E -F -T -i)-a[specify that arguments refer to arrays]"
df "-d[default absolute path autoload to fpath]"
f "($popts)-f[specify that arguments refer to functions]"
g "($fopts -T)-+g[do not restrict parameter to local scope]"
h "($fopts -T)-+h[hide specialness of parameter]"
@ -31,6 +32,8 @@ allargs=(
m '(-A -E -F -T -i)-m[treat arguments as patterns]'
p '-p[output parameters in form of calls to typeset]'
r '(-f)-+r[mark parameters as readonly]'
rf '-r[remember autoload path]'
Rf '-R[remember autoload path, error if not found]'
t '(-T)-+t[tag parameters and turn on execution tracing for functions]'
tf '(-T)-+t[turn on execution tracing for functions]'
tp '(-T)-+t[tag parameters]'
@ -46,7 +49,7 @@ use="AEFHLRTUZafghiklmprtuxz"
case ${service} in
autoload)
use="UTXktwz"
use="URTXdkrtwz"
func=f
;;
float) use="EFHghlprtux";;
@ -74,7 +77,7 @@ onopts=${(j..)${${words[1,CURRENT-1]:#^-*}##-}}
offopts=${(j..)${${words[1,CURRENT-1]:#^+*}##+}}
for ((i=1;i<=$#use;++i)); do
args+=( ${allargs[${use[$i]}${${(s::)use[$i]}[(r)[UutT]]:+$func}]} )
args+=( ${allargs[${use[$i]}${${(s::)use[$i]}[(r)[dUurRtT]]:+$func}]} )
done
_arguments -C -s -A "-*" -S "${args[@]}" '*::vars:= ->vars_eq'
@ -90,12 +93,17 @@ if [[ "$state" = vars_eq ]]; then
elif (( $+opt_args[-w] )); then
_wanted files expl 'zwc file' _files -g '*.zwc(-.)'
elif [[ $service = autoload || -n $opt_args[(i)-[uU]] ]]; then
args=(${^fpath}/*(-.:t))
# Filter out functions already loaded or marked for autoload.
local -a funckeys
funckeys=(${(k)functions})
args=(${args:|funckeys})
_wanted functions expl 'shell function' compadd -a args
if [[ $PREFIX[1] = / ]]; then
# Autoload by absolute path
_files
else
args=(${^fpath}/*(-.:t))
# Filter out functions already loaded or marked for autoload.
local -a funckeys
funckeys=(${(k)functions})
args=(${args:|funckeys})
_wanted functions expl 'shell function' compadd -a args
fi
elif [[ -n $onopts$offopts ]]; then
if [[ -n $offopts ]]; then
args=(${(f)"$(functions +${offopts//[^UXkmtTuz]/})"})