diff options
author | Oliver Kiddle <opk@zsh.org> | 2015-06-02 00:52:11 +0200 |
---|---|---|
committer | Oliver Kiddle <opk@zsh.org> | 2015-06-02 00:52:11 +0200 |
commit | 52cace80567dc53fa8d32f3664b524b5e8ec905b (patch) | |
tree | f377e740b33e20fb22f559543db19b387b254339 /Completion/Unix/Type/_ttys | |
parent | 72ecc2ef36b203175aad3f6dd4b76e474a82d8b6 (diff) | |
download | zsh-52cace80567dc53fa8d32f3664b524b5e8ec905b.tar.gz zsh-52cace80567dc53fa8d32f3664b524b5e8ec905b.tar.xz zsh-52cace80567dc53fa8d32f3664b524b5e8ec905b.zip |
35356: factor out completion of tty devices
Diffstat (limited to 'Completion/Unix/Type/_ttys')
-rw-r--r-- | Completion/Unix/Type/_ttys | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Completion/Unix/Type/_ttys b/Completion/Unix/Type/_ttys new file mode 100644 index 000000000..5e5598570 --- /dev/null +++ b/Completion/Unix/Type/_ttys @@ -0,0 +1,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 |