about summary refs log tree commit diff
path: root/Completion/Builtins
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-05-29 08:00:46 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-05-29 08:00:46 +0000
commita2750a4effef1db7966530cd39905dbb7cf2b99c (patch)
tree0ccf8cc00e18527fe9e59d093c20bcf0dbe812bf /Completion/Builtins
parent7a3ca7a673d98fcbe50c192cba6165d17505e394 (diff)
downloadzsh-a2750a4effef1db7966530cd39905dbb7cf2b99c.tar.gz
zsh-a2750a4effef1db7966530cd39905dbb7cf2b99c.tar.xz
zsh-a2750a4effef1db7966530cd39905dbb7cf2b99c.zip
fixes for _arguments with sets; make _zpty not use sets (11624)
Diffstat (limited to 'Completion/Builtins')
-rw-r--r--Completion/Builtins/_zpty53
1 files changed, 39 insertions, 14 deletions
diff --git a/Completion/Builtins/_zpty b/Completion/Builtins/_zpty
index de793c814..dd551ab97 100644
--- a/Completion/Builtins/_zpty
+++ b/Completion/Builtins/_zpty
@@ -3,19 +3,42 @@
 local state line list names expl curcontext="$curcontext"
 typeset -A opt_args
 
+
 _arguments -C -s \
-  '(-r)*::args:_normal' \
- - eb \
-  '-e[echo input characters]' \
-  '-b[io to pseudo-terminal blocking]' \
- - d \
-  '-d[delete command]:*:name:->name' \
- - w \
-  '-w[send string to command]:name:->name:*:strings to write' \
- - L \
-  '-L[list defined commands as calls]' \
- - r \
-  '(*)-r[read string from command]:name:->name:param:_parameters' && return 0
+  '(-r -w -L -d)-e[echo input characters]' \
+  '(-r -w -L -d)-b[io to pseudo-terminal blocking]' \
+  '(-r -w -L -e -b)-d[delete command]:*:name:->name' \
+  '(-r -L -e -b -d)-w[send string to command]:name:->name:*:strings to write' \
+  '(: -r -w -e -b -d)-L[list defined commands as calls]' \
+  '(: -w -L -e -b -d)-r[read string from command]:name:->name:param: _parameters:pattern:' \
+  '(-r -w -L -d):zpty command name:' \
+  '(-r -w -L -d):cmd: _command_names -e' \
+  '(-r -w -L -d)*::args:_precommand' && return 0
+
+# One could use sets, but that's more expensive and zpty is simple enough.
+#
+# _arguments -C -s \
+#   - read \
+#     '-r[read string from command]' \
+#     ':name:->name' \
+#     ':param: _parameters' \
+#     ':pattern:' \
+#   - write \
+#     '-w[send string to command]' \
+#     ':name:->name' \
+#     '*:strings to write' \
+#   - list \
+#     '-L[list defined commands as calls]' \
+#   - delete \
+#     '-d[delete command]' \
+#     '*:name:->name' \
+#   - start \
+#     '-e[echo input characters]' \
+#     '-b[io to pseudo-terminal blocking]' \
+#     ':zpty command name:' \
+#     ':cmd: _command_names -e' \
+#     '*::args:_precommand' && return 0
+
 
 if [[ $state = name ]]; then
   if ! zmodload -e zsh/zpty; then
@@ -26,8 +49,10 @@ if [[ $state = name ]]; then
   names=( ${list%%:*} )
   if zstyle -T ":completion:${curcontext}" verbose; then
     zformat -a list ' --' ${${(f)"$(zpty)"}#*\) }
-    _wanted names expl 'zpty command names' compadd -d list - "$names[@]"
+    _wanted names expl 'zpty command name' compadd -d list - "$names[@]"
   else
-    _wanted names expl 'zpty command names' compadd - "$names[@]"
+    _wanted names expl 'zpty command name' compadd - "$names[@]"
   fi
+else
+  return 1
 fi