From c4878bbfa4e08294302d20a342322892c6317aa8 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 26 Sep 2002 11:11:54 +0000 Subject: 17682: add support for -H in typeset completion --- ChangeLog | 3 ++ Completion/Zsh/Command/_typeset | 75 +++++++++++++++++++++++++++++++++++++++++ Doc/Zsh/builtins.yo | 8 ++--- 3 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 Completion/Zsh/Command/_typeset diff --git a/ChangeLog b/ChangeLog index 940219711..4349c59fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2002-09-26 Oliver Kiddle + * 17682 (modified for 4.0): Completion/Zsh/Command/_typeset, + Doc/Zsh/builtins.yo: add support for -H option to completion + * unposted: Completion/Unix/Command/_bzip2: recognise also .tbz and .tbz2 files diff --git a/Completion/Zsh/Command/_typeset b/Completion/Zsh/Command/_typeset new file mode 100644 index 000000000..cc0676376 --- /dev/null +++ b/Completion/Zsh/Command/_typeset @@ -0,0 +1,75 @@ +#compdef declare export integer float local readonly typeset + +local expl state line func i use curcontext="$curcontext" +local -A allargs +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]' + 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]' + m '(-A -E -F -T -i)-m[treat arguments as patterns]' + r '(-f)-+r[mark parameters as readonly]' + 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]' + 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]' +) + +use="AEFHLRTUZafghilmrtux" + +case ${service} in + float) use="EFHghlrtux";; + functions) + use="Umtu" + func=f + ;; + integer) + use="Hghilrtux" + allargs[i]='-i[specify arithmetic base for output]' + ;; + readonly) use="${use/r/}" ;; + local) use="${use/f/}" ;& + export) use="${${use/g/}/x/}" ;; +esac + +[[ -z "${words[(r)-*f*]}" ]] || func=f +[[ -z "${words[(r)-*[aA]*]}" ]] || func=p + +for ((i=1;i<=$#use;++i)); do + args=( "${args[@]}" \ + ${allargs[${use[$i]}${${(s::)use[$i]}[(r)[Uut]]:+$func}]} ) +done + +_arguments -C -s -A "-*" -S "${args[@]}" '*:vars:->vars_eq' + +if [[ "$state" = vars_eq ]]; then + if [[ $func = f ]]; then + _functions + elif [[ "$PREFIX" = *\=* ]]; then + compstate[parameter]="${PREFIX%%\=*}" + compset -P 1 '*=' + _value + elif (( $+opt_args[-a] || $+opt_args[-A] )); then + _parameters -q + else + _parameters -q -S '=' + fi +fi diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index 8479e5897..17a65a53a 100644 --- a/Doc/Zsh/builtins.yo +++ b/Doc/Zsh/builtins.yo @@ -403,7 +403,7 @@ Bring each specified var(job) in turn to the foreground. If no var(job) is specified, resume the current job. ) findex(float) -item(tt(float) [ {tt(PLUS())|tt(-)}tt(EFghlrtux) ] [ var(name)[tt(=)var(value)] ... ])( +item(tt(float) [ {tt(PLUS())|tt(-)}tt(EFHghlrtux) ] [ var(name)[tt(=)var(value)] ... ])( Equivalent to tt(typeset -E), except that options irrelevant to floating point numbers are not permitted. ) @@ -504,7 +504,7 @@ the form of a call to hash. ) alias(history)(fc -l) findex(integer) -item(tt(integer) [ {tt(PLUS())|tt(-)}tt(ghilrtux) ] [ var(name)[tt(=)var(value)] ... ])( +item(tt(integer) [ {tt(PLUS())|tt(-)}tt(Hghilrtux) ] [ var(name)[tt(=)var(value)] ... ])( Equivalent to tt(typeset -i), except that options irrelevant to integers are not permitted. ) @@ -602,7 +602,7 @@ sitem([var(mm)tt(:)]var(ss))(minutes and seconds) endsitem() ) findex(local) -item(tt(local) [ {tt(PLUS())|tt(-)}tt(AEFLRUZahilrtux) [var(n)]] [ var(name)[tt(=)var(value)] ] ...)( +item(tt(local) [ {tt(PLUS())|tt(-)}tt(AEFHLRUZahilrtux) [var(n)]] [ var(name)[tt(=)var(value)] ] ...)( Same as tt(typeset), except that the options tt(-g), and tt(-f) are not permitted. In this case the tt(-x) option does not force the use of tt(-g), i.e. exported variables will be local to functions. @@ -1020,7 +1020,7 @@ Equivalent to tt(whence -v). findex(typeset) cindex(parameters, setting) cindex(parameters, declaring) -xitem(tt(typeset) [ {tt(PLUS())|tt(-)}tt(AEFLRUZafghilrtuxm) [var(n)]] [ \ +xitem(tt(typeset) [ {tt(PLUS())|tt(-)}tt(AEFHLRUZafghilrtuxm) [var(n)]] [ \ var(name)[tt(=)var(value)] ... ]) item(tt(typeset) -T [ {tt(PLUS()|tt(-))}tt(LRUZrux) ] \ var(SCALAR)[tt(=)var(value)] var(array))( -- cgit 1.4.1