summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2015-06-02 00:52:11 +0200
committerOliver Kiddle <opk@zsh.org>2015-06-02 00:52:11 +0200
commit52cace80567dc53fa8d32f3664b524b5e8ec905b (patch)
treef377e740b33e20fb22f559543db19b387b254339 /Completion/Unix/Command
parent72ecc2ef36b203175aad3f6dd4b76e474a82d8b6 (diff)
downloadzsh-52cace80567dc53fa8d32f3664b524b5e8ec905b.tar.gz
zsh-52cace80567dc53fa8d32f3664b524b5e8ec905b.zip
35356: factor out completion of tty devices
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/_gdb6
-rw-r--r--Completion/Unix/Command/_last4
-rw-r--r--Completion/Unix/Command/_pgrep8
-rw-r--r--Completion/Unix/Command/_ps5
4 files changed, 9 insertions, 14 deletions
diff --git a/Completion/Unix/Command/_gdb b/Completion/Unix/Command/_gdb
index 48c9d654f..f387c878a 100644
--- a/Completion/Unix/Command/_gdb
+++ b/Completion/Unix/Command/_gdb
@@ -5,17 +5,19 @@ local cur="$words[CURRENT]" prev w list ret=1 expl
[[ "$PREFIX" = --* ]] &&
_arguments -- '*=(CORE|SYM)FILE:core file:_files' \
'*=EXECFILE:executable:_files -g \*\(-\*\)' \
- '*=TTY:terminal device:compadd /dev/tty\*' && return 0
+ '*=TTY:terminal device:_ttys' && return 0
if compset -P '-(cd|directory)='; then
_files -/
elif compset -P '-tty='; then
- _wanted devices expl 'terminal device' compadd - /dev/tty*
+ _wanted devices expl 'terminal device' _ttys
elif compset -P '-(exec|se)='; then
_description files expl executable
_files "$expl[@]" -g '*(-*)'
elif compset -P '-(symbols|core|command)='; then
_files
+elif compset -P '--pid='; then
+ _pids
elif [[ "$PREFIX" = -* ]]; then
_tags options
while _tags; do
diff --git a/Completion/Unix/Command/_last b/Completion/Unix/Command/_last
index 706d82f26..f198e0fff 100644
--- a/Completion/Unix/Command/_last
+++ b/Completion/Unix/Command/_last
@@ -9,7 +9,7 @@ for pattern arg in \
'((free|net|open)bsd*|darwin*|dragonfly*|linux-gnu)' '-h[limit sessions by hostname]:host:_hosts' \
'((free|open)bsd*|linux-gnu)' '-s[report duration in seconds]' \
'(freebsd*|openbsd*)' '-d[limit sessions to those active at snapshot time]:time ([[CC]YY][MMDD]hhmm[.SS])' \
- '((net|free|open)bsd*|darwin*|dragonfly*)' '-t[limit sessions by tty]:tty:compadd -a ttys' \
+ '((net|free|open)bsd*|darwin*|dragonfly*)' '-t[limit sessions by tty]:tty:_ttys -D' \
'openbsd*' '-c[calculate total time]' \
'^darwin*' '-f[specify account file]:file:_files' \
'(solaris*|linux-gnu|freebsd*|openbsd*)' '-n[specify number of lines to show]:number' \
@@ -45,7 +45,7 @@ case $OSTYPE in
esac
if [[ $OSTYPE = (linux-gnu|solaris*) ]]; then
- args+=( '*:arg: _alternative "users:user:_users" "ttys:tty:compadd -a ttys"' )
+ args+=( '*:arg: _alternative "users:user:_users" "ttys:tty:_ttys -d" "ttys:tty:(reboot)"' )
else
args+=( '*:user:_users' )
fi
diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep
index d3dcd1812..0b7d23d4d 100644
--- a/Completion/Unix/Command/_pgrep
+++ b/Completion/Unix/Command/_pgrep
@@ -13,7 +13,7 @@ arguments=('-P[parent process id]:parent process id:->ppid'
'-M[extract the name list from the specified core]:files:_files'
'-N[extract the name list from the specified system]:files:_files'
'-s[match only session id]:session id:->sid'
- '-t[match only controlled by terminal]:terminal device:->tty'
+ '-t[match only controlled by terminal]:terminal device:_sequence _ttys -d'
'-T[match only in processes specified routing table in rtable]'
'-u[match only effective user id]:user:_users'
'-U[match only real user id]:user:_users'
@@ -69,12 +69,6 @@ arguments=( ${(M)arguments:#(|\*)(|\(*\))-[$optchars]*}
_arguments -C -s -w $arguments && ret=0
case $state in
- (tty)
- local -a ttys
- ttys=( /dev/tty*(N) /dev/pts/*(N) )
- _sequence -s , _wanted tty expl 'terminal device' compadd - ${ttys#/dev/}
- ;;
-
(sid)
if [[ $OSTYPE == openbsd* ]]; then
break
diff --git a/Completion/Unix/Command/_ps b/Completion/Unix/Command/_ps
index e557b27b9..6f67f7933 100644
--- a/Completion/Unix/Command/_ps
+++ b/Completion/Unix/Command/_ps
@@ -31,7 +31,7 @@ args=(
'*-G+[select processes by real group]:group:_sequence -s , _groups'
'*-g+[select processes by effective group or session]:group:_sequence -s , _groups'
'*-s+[select processes by session leaders]:session leader:_sequence -s , _pids'
- '*-t+[select processes by attached terminal]:tty:_sequence -s , compadd - /dev/pts/<->(N\:s/\\/dev\\//) /dev/tty*(N\:t)'
+ '*-t+[select processes by attached terminal]:tty:_sequence -s , _ttys -D'
'*-u+[select processes by effective user]:user:_sequence -s , _users'
'*-U+[select processes by real user]:user:_sequence -s , _users'
'-o+[specify output format]:property:_sequence -s , _ps_props -'
@@ -163,8 +163,7 @@ if (( CURRENT > 1 )) && [[ $OSTYPE != solaris* || ( $OSTYPE = linux-gnu && $word
*J) _sequence _jails -0 && return ;;
*[MNW]) _files && return ;;
*t)
- _wanted -C option-t-1 ttys expl tty _sequence -s , \
- compadd - /dev/pts/<->(N\:s/\\/dev\\//) /dev/tty*(N\:t) && return
+ _wanted -C option-t-1 ttys expl tty _sequence -s , _ttys -D && return
;;
*p) _wanted -C option-p-1 processes expl 'process ID' _sequence -s , _pids && return;;
*U) _wanted -C option-U-1 users expl user _sequence -s , _users && return ;;