1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-20 14:04:03 +01:00
zsh/Completion/Builtins/_zpty

59 lines
1.7 KiB
Plaintext
Raw Normal View History

2000-03-09 12:46:28 +01:00
#compdef zpty
local state line list names expl curcontext="$curcontext"
typeset -A opt_args
2000-03-09 12:46:28 +01:00
2000-03-09 12:46:28 +01:00
_arguments -C -s \
'(-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
2000-03-09 12:46:28 +01:00
if [[ $state = name ]]; then
if ! zmodload -e zsh/zpty; then
_message "zpty module not loaded"
return 1
fi
2000-03-09 12:46:28 +01:00
list=( ${${(f)"$(zpty)"}#*\) } )
names=( ${list%%:*} )
if zstyle -T ":completion:${curcontext}" verbose; then
zformat -a list ' --' ${${(f)"$(zpty)"}#*\) }
2000-05-31 11:38:25 +02:00
_wanted names expl 'zpty command name' compadd -d list -a names
2000-03-09 12:46:28 +01:00
else
2000-05-31 11:38:25 +02:00
_wanted names expl 'zpty command name' compadd -a names
2000-03-09 12:46:28 +01:00
fi
else
return 1
2000-03-09 12:46:28 +01:00
fi