new completion for read builtin (12578)

This commit is contained in:
Oliver Kiddle 2000-08-09 21:20:37 +00:00
parent cb89544d32
commit 4239b1243a
4 changed files with 28 additions and 5 deletions

View file

@ -1,3 +1,8 @@
2000-08-09 Oliver Kiddle <opk@zsh.org>
* 12578: Completion/Builtins/_read, Completion/Builtins/_vars,
Completion/Builtins/.distfiles: new completion for read builtin
2000-08-08 Clint Adams <schizo@debian.org>
* 12568: configure.in, Src/compat.c, Src/exec.c, Src/init.c,

View file

@ -2,7 +2,7 @@ DISTFILES_SRC='
.distfiles
_aliases _arrays _autoload _bg_jobs _bindkey _builtin _cd _command
_compdef _disable _echotc _emulate _enable _fc _fg_jobs _functions
_hash _kill _limits _nothing _pids _popd _print _sched _set _setopt
_source _stat _trap _unhash _unsetopt _vars _vars_eq _wait _which
_zcompile _zftp _zle _zmodload _zpty _signals _zstyle
_hash _kill _limits _nothing _pids _popd _print _read _sched _set
_setopt _source _stat _trap _unhash _unsetopt _vars _vars_eq _wait
_which _zcompile _zftp _zle _zmodload _zpty _signals _zstyle
'

18
Completion/Builtins/_read Normal file
View file

@ -0,0 +1,18 @@
#compdef read
local pflag expl line curcontext="$curcontext"
# -p flag only relevant if we have a coprocess
(:>&p) 2>/dev/null &&
pflag='(-q -u -z)-p[input is read from the coprocess]'
_arguments -C -s \
'-r[raw mode]' \
'(-p -k -u -z)-q[read y or n character from terminal]' \
'(-q)-k[specify number of characters to read]:number of characters' \
'(-q -u -p)-z[read entry from editor buffer stack]' \
'(-E)-e[input read is echoed and not assigned]' \
'(-e)-E[input read is echoed]' \
'-A[first name is taken as an array]' \
'(-q -z -p)-u+[specify file-descriptor to read from]:file-descriptor:_file_descriptors' \
$pflag '1:varprompt:_vars -qS\?' '*:vars:_vars'

View file

@ -1,4 +1,4 @@
#compdef getopts read unset vared
#compdef getopts unset vared
# This will handle completion of keys of associative arrays, e.g. at
# `vared foo[<TAB>'. However, in this version the [ must be added
@ -20,5 +20,5 @@ if [[ $PREFIX = *\[* ]]; then
compadd $addclose -k "$var"
fi
else
_parameters
_parameters "$@"
fi