about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Builtins/.distfiles6
-rw-r--r--Completion/Builtins/_read18
-rw-r--r--Completion/Builtins/_vars4
3 files changed, 23 insertions, 5 deletions
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[<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