#compdef zpty local state line list names expl curcontext="$curcontext" typeset -A opt_args _arguments -C -s \ '(-d -w -r -L)-e[echo input characters]' \ '(-d -w -r -L)-b[io to pseudo-terminal blocking]' \ '(-e -b -w -r -L)-d[delete command]:*:name:->name' \ '(-e -b -d -r -L)-w[send string to command]:name:->name:*:strings to write' \ '(-e -b -d -w -L *)-r[read string from command]:name:->name:param:_parameters' \ '(-e -b -d -w -r)-L[list defined commands as calls]' \ '(-r)*::args:_normal' && return 0 if [[ $state = name ]]; then list=( ${${(f)"$(zpty)"}#*\) } ) names=( ${list%%:*} ) if zstyle -T ":completion:${curcontext}" verbose; then zformat -a list ' --' ${${(f)"$(zpty)"}#*\) } _wanted names expl 'zpty command names' compadd -d list - "$names[@]" else _wanted names expl 'zpty command names' compadd - "$names[@]" fi fi