From 52cace80567dc53fa8d32f3664b524b5e8ec905b Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Tue, 2 Jun 2015 00:52:11 +0200 Subject: 35356: factor out completion of tty devices --- Completion/Unix/Type/_ttys | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Completion/Unix/Type/_ttys (limited to 'Completion/Unix/Type/_ttys') 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 -- cgit 1.4.1