summaryrefslogtreecommitdiff
path: root/Completion/Zsh/Command
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Zsh/Command')
-rw-r--r--Completion/Zsh/Command/_autoload10
-rw-r--r--Completion/Zsh/Command/_typeset73
2 files changed, 47 insertions, 36 deletions
diff --git a/Completion/Zsh/Command/_autoload b/Completion/Zsh/Command/_autoload
deleted file mode 100644
index 50423d51a..000000000
--- a/Completion/Zsh/Command/_autoload
+++ /dev/null
@@ -1,10 +0,0 @@
-#compdef autoload
-
-local expl
-
-if (( $words[(I)[-+]*w*] )); then
- _description files expl 'zwc file'
- _files "$expl[@]" -g '*.zwc(-.)'
-else
- _wanted functions expl 'shell function' compadd - ${^fpath}/*(:t)
-fi
diff --git a/Completion/Zsh/Command/_typeset b/Completion/Zsh/Command/_typeset
index 93e773ace..587ce03f9 100644
--- a/Completion/Zsh/Command/_typeset
+++ b/Completion/Zsh/Command/_typeset
@@ -1,27 +1,31 @@
-#compdef declare export integer float local readonly typeset
+#compdef autoload declare export functions integer float local readonly typeset
local expl state line func i use curcontext="$curcontext"
-local -A allargs
+local fopts="-f -k -z"
+local popts="-A -E -F -L -R -T -Z -a -g -h -H -i -l -r -x"
+local -A allargs opt_args
local -a args
allargs=(
- A '(-E -F -L -R -T -U -Z -a -f -i -m)-A[specify that arguments refer to associative arrays]'
- E '(-A -F -L -R -T -U -Z -a -f -i -m)-E[floating point, use engineering notation on output]'
- F '(-A -E -L -R -T -U -Z -a -f -i -m)-F[floating point, use fixed point decimal on output]'
- L '(-A -E -F -f -i)-L+[left justify and remove leading blanks from value]:width'
- R '(-A -E -F -f -i)-R+[right justify and fill with leading blanks]:width'
- T '(-A -E -F -a -f -g -h -i -l -m -t)-T[tie scalar to array]'
+ A "($fopts -E -F -L -R -T -U -Z -a -i -m)-A[specify that arguments refer to associative arrays]"
+ E "($fopts -A -F -L -R -T -U -Z -a -i -m)-E[floating point, use engineering notation on output]"
+ F "($fopts -A -E -L -R -T -U -Z -a -i -m)-F[floating point, use fixed point decimal on output]"
+ L "($fopts -A -E -F -i)-L+[left justify and remove leading blanks from value]:width"
+ R "($fopts -A -E -F -i)-R+[right justify and fill with leading blanks]:width"
+ T "($fopts -A -E -F -a -g -h -i -l -m -t)-T[tie scalar to array]"
U '(-A -E -F -i)-U[keep array values unique and suppress alias expansion for functions]'
- Uf '(-E -F -i)-U[suppress alias expansion for functions]'
- Up '(-E -F -i)-U[keep array values unique]'
- Z '(-A -E -F -f -i)-Z+[right justify and fill with leading zeros]:width'
- a '(-A -E -F -T -f -i)-a[specify that arguments refer to arrays]'
- f '(-A -E -F -L -R -T -Z -a -g -h -i -l -r -x)-f[specify that arguments refer to functions]'
- g '(-T -f)-+g[do not restrict parameter to local scope]'
- h '(-T -f)-+h[hide specialness of parameter]'
- H '(-T -f)-+H[hide value of parameter in listings]'
- i '(-A -E -F -T -f)-+i[represent internally as an integer]'
- l '(-T -f)-l[convert the value to lowercase]'
+ Uf '-U[suppress alias expansion for functions]'
+ Up '(-E -F -i)-+U[keep array values unique]'
+ 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]"
+ 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]"
+ H "($fopts -T)-+H[hide value of parameter in listings]"
+ i "($fopts -A -E -F -T)-+i[represent internally as an integer]"
+ k "($popts -w -z)-+k[mark function for ksh-style autoloading]"
+ l "($popts -T)-l[convert the value to lowercase]"
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]'
@@ -31,15 +35,21 @@ allargs=(
u '-u[convert the value to uppercase or mark function for autoloading]'
uf '-u[mark function for autoloadling]'
up '-u[convert the value to uppercase]'
- x '(-f)-+x[export parameter]'
+ w '(-k -z)-w[specify that arguments refer to files compiled with zcompile]'
+ x "($fopts)-+x[export parameter]"
+ z "($popts -k -w)-+z[mark function for zsh-style autoloading]"
)
-use="AEFHLRTUZafghilmprtux"
+use="AEFHLRTUZafghiklmprtuxz"
case ${service} in
+ autoload)
+ use="UXktwz"
+ func=f
+ ;;
float) use="EFHghlprtux";;
functions)
- use="Umtu"
+ use="Ukmtuz"
func=f
;;
integer)
@@ -47,28 +57,39 @@ case ${service} in
allargs[i]='-i[specify arithmetic base for output]' \
;;
readonly) use="${use/r/}" ;;
- local) use="${use/f/}" ;&
- export) use="${${use/g/}/x/}" ;;
+ local) use="${use/[fkz]/}" ;&
+ export) use="${${use//[gkz]/}/x/}" ;;
esac
-[[ -z "${words[(r)-*f*]}" ]] || func=f
[[ -z "${words[(r)-*[aA]*]}" ]] || func=p
+[[ -z "${words[(r)-*f*]}" ]] || func=f
for ((i=1;i<=$#use;++i)); do
args+=( ${allargs[${use[$i]}${${(s::)use[$i]}[(r)[Uut]]:+$func}]} )
done
-_arguments -C -s -A "-*" -S "${args[@]}" '*:vars:->vars_eq'
+_arguments -C -s -A "-*" -S "${args[@]}" '*::vars:= ->vars_eq'
if [[ "$state" = vars_eq ]]; then
if [[ $func = f ]]; then
- _functions
+ if (( $+opt_args[-w] ));then
+ _wanted files expl 'zwc file' _files -g '*.zwc(-.)'
+ elif [[ $service = autoload || -n $opt_args[(i)-[uU]] ]]; then
+ _wanted functions expl 'shell function' compadd - ${^fpath}/*(:t)
+ else
+ _functions
+ fi
elif [[ "$PREFIX" = *\=* ]]; then
compstate[parameter]="${PREFIX%%\=*}"
compset -P 1 '*='
_value
elif (( $+opt_args[-a] || $+opt_args[-A] )); then
_parameters -q
+ elif (( $+opt_args[-T] )); then
+ _arguments \
+ ':scalar parameter:_parameters -g "*scalar*" -q -S "="' \
+ ':array parameter:_parameters -g "*array*"' \
+ ':separator character'
else
_parameters -q -S '='
fi