about summary refs log tree commit diff
path: root/Completion/Builtins/_zpty
blob: 4090bde6945434f755a3de7d242916df351cd6ac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#compdef zpty

local state line list names expl

_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:*:nothing:_nothing' \
  '(-e -b -d -w -r)-L[list defined commands as calls]' \
  '*::args:_normal'

if [[ $state = name ]] && _wanted names; then
  list=( ${${(f)"$(zpty)"}#*\) } )
  names=( ${list%%:*} )
  if zstyle -T ":completion:${curcontext}" verbose; then
    zformat -a list ' --' ${${(f)"$(zpty)"}#*\) }
    _loop names expl 'zpty command names' compadd -d list - "$names[@]"
  else
    _loop names expl 'zpty command names' compadd - "$names[@]"
  fi
fi