about summary refs log tree commit diff
path: root/Completion/Unix/Type/_ttys
blob: 5e5598570f36fdea7e6600845c1d159b6992f670 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#autoload

# Options:
#
# -d  strip /dev/ prefix from matches
# -D  matches allowed with or without /dev/ prefix

local -a ttys expl pre
local stripdev optdev

zparseopts -D -K -E d=stripdev D=optdev

ttys=( /dev/tty?*(N) /dev/pts/^ptmx(N) )
ttys=( ${ttys#/dev/} )
[[ -z $stripdev ]] && pre=( -p /dev/ )

_description ttys expl 'tty'
[[ -n $optdev ]] && compadd "$@" "$expl[@]" -M 'r:|/=* r:|=*' -a ttys && return
compadd "$@" "$expl[@]" "$pre[@]" -M 'r:|/=* r:|=*' -a ttys