From 4239b1243a4795fc6e7207151334cce03dafe44e Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Wed, 9 Aug 2000 21:20:37 +0000 Subject: new completion for read builtin (12578) --- ChangeLog | 5 +++++ Completion/Builtins/.distfiles | 6 +++--- Completion/Builtins/_read | 18 ++++++++++++++++++ Completion/Builtins/_vars | 4 ++-- 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 Completion/Builtins/_read diff --git a/ChangeLog b/ChangeLog index 5486e41cf..de4ae298f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-08-09 Oliver Kiddle + + * 12578: Completion/Builtins/_read, Completion/Builtins/_vars, + Completion/Builtins/.distfiles: new completion for read builtin + 2000-08-08 Clint Adams * 12568: configure.in, Src/compat.c, Src/exec.c, Src/init.c, diff --git a/Completion/Builtins/.distfiles b/Completion/Builtins/.distfiles index 93a6ce398..d2878d165 100644 --- a/Completion/Builtins/.distfiles +++ b/Completion/Builtins/.distfiles @@ -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 ' diff --git a/Completion/Builtins/_read b/Completion/Builtins/_read new file mode 100644 index 000000000..a648701d9 --- /dev/null +++ b/Completion/Builtins/_read @@ -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' diff --git a/Completion/Builtins/_vars b/Completion/Builtins/_vars index 6444c68fe..a46b99de0 100644 --- a/Completion/Builtins/_vars +++ b/Completion/Builtins/_vars @@ -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['. However, in this version the [ must be added @@ -20,5 +20,5 @@ if [[ $PREFIX = *\[* ]]; then compadd $addclose -k "$var" fi else - _parameters + _parameters "$@" fi -- cgit 1.4.1