about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorMatthew Martin <phy1729@gmail.com>2022-03-18 20:49:48 -0500
committerMatthew Martin <phy1729@gmail.com>2022-03-18 20:52:18 -0500
commit78649ac72596104cfcbaad9a5a7d1a1afa981a4c (patch)
treec5fb6fcd1654afc478af052a350fe5df70b1e321 /Completion
parent8dd733dfd2d2c72f063c7eba3482d870e2ec26c3 (diff)
downloadzsh-78649ac72596104cfcbaad9a5a7d1a1afa981a4c.tar.gz
zsh-78649ac72596104cfcbaad9a5a7d1a1afa981a4c.tar.xz
zsh-78649ac72596104cfcbaad9a5a7d1a1afa981a4c.zip
49852: Add _routing_domains and _routing_tables types
Diffstat (limited to 'Completion')
-rw-r--r--Completion/BSD/Command/_pfctl2
-rw-r--r--Completion/BSD/Type/_routing_domains6
-rw-r--r--Completion/BSD/Type/_routing_tables6
-rw-r--r--Completion/Unix/Command/_arp2
-rw-r--r--Completion/Unix/Command/_netstat2
-rw-r--r--Completion/Unix/Command/_pgrep3
-rw-r--r--Completion/Unix/Command/_ping2
-rw-r--r--Completion/Unix/Command/_route2
-rw-r--r--Completion/Unix/Command/_top2
9 files changed, 19 insertions, 8 deletions
diff --git a/Completion/BSD/Command/_pfctl b/Completion/BSD/Command/_pfctl
index 23898882f..812e52bdb 100644
--- a/Completion/BSD/Command/_pfctl
+++ b/Completion/BSD/Command/_pfctl
@@ -66,7 +66,7 @@ case $OSTYPE in
       "-N[don't perform domain name resolution]"
       '-P[display ports using service names]'
       '-S+[store pf state table in the specified file]:file:_files'
-      '-V+[select routing domain to be used to kill states]:routing domain'
+      '-V+[select routing domain to be used to kill states]:routing domain:_routing_domains'
     )
   ;;
   (free|net)bsd*)
diff --git a/Completion/BSD/Type/_routing_domains b/Completion/BSD/Type/_routing_domains
new file mode 100644
index 000000000..4bb9f78b0
--- /dev/null
+++ b/Completion/BSD/Type/_routing_domains
@@ -0,0 +1,6 @@
+#autoload
+
+local expl
+
+_description routing-domains expl 'routing domain'
+compadd "$@" "$expl[@]" -  ${${(M)${(f)"$(_call_program routing-domains netstat -R)"}:#Rdomain *}#Rdomain }
diff --git a/Completion/BSD/Type/_routing_tables b/Completion/BSD/Type/_routing_tables
new file mode 100644
index 000000000..3ba1931fe
--- /dev/null
+++ b/Completion/BSD/Type/_routing_tables
@@ -0,0 +1,6 @@
+#autoload
+
+local expl
+
+_description routing-tables expl 'routing table'
+compadd "$@" "$expl[@]" -  ${(s: :)${${(M)${(f)"$(_call_program routing-tables netstat -R)"}:#  Routing tables#: *}#*: }}
diff --git a/Completion/Unix/Command/_arp b/Completion/Unix/Command/_arp
index 389f1099b..7727de28c 100644
--- a/Completion/Unix/Command/_arp
+++ b/Completion/Unix/Command/_arp
@@ -61,7 +61,7 @@ case $OSTYPE in
   openbsd*)
     args+=(
       '(-a -d -W)-F[overwrite existing entries]'
-      '(-W)-V+[select the routing domain]:routing domain'
+      '(-W)-V+[select the routing domain]:routing domain:_routing_domains'
     )
     cmds+=(
       '(- 1)-W[send the wake on LAN frame]'
diff --git a/Completion/Unix/Command/_netstat b/Completion/Unix/Command/_netstat
index aa6c92fde..67133dc6c 100644
--- a/Completion/Unix/Command/_netstat
+++ b/Completion/Unix/Command/_netstat
@@ -270,7 +270,7 @@ case $OSTYPE in
     sel_rdomains=( '-R[show all rdomains with associated interfaces and routing tables]' )
     sel_wireless=( '-W+[display per-interface IEEE 802.11 wireless statistics]:interface' )
     flist+=( local mpls )
-    tblopt='-T+[select an alternate routing table to query]:routing table'
+    tblopt='-T+[select an alternate routing table to query]:routing table:_routing_tables'
     sockets+=( -l$lopt $tblopt '-B[show buffer sizes for TCP sockets]' )
     routing+=( $Mopts $tblopt
       '-A[show the internal addresses of the routing table]'
diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep
index afd2fe54b..9c3ddf039 100644
--- a/Completion/Unix/Command/_pgrep
+++ b/Completion/Unix/Command/_pgrep
@@ -5,7 +5,6 @@
 #   (which changed the behaviour of -f and added -a)
 # - We don't really need to keep pgopts and pkopts separate, but it seems like
 #   it should make things a bit easier to follow
-# - @todo We could complete routing tables given to -T
 
 local curcontext="$curcontext" state line ret=1 expl pgopts pkopts no
 typeset -A opt_args
@@ -39,7 +38,7 @@ arguments=(
   '(-s --session)'{-s+,--session=}'[match only on specified process session IDs]: :->sid'
   # _signals is OK here - we do it differently below
   '(ss)--signal=[specify signal to send to process]: :_signals -s'
-  '-T+[match only on specified routing table]:routing table'
+  '-T+[match only on specified routing table]:routing table:_routing_tables'
   '(-t --terminal)'{-t+,--terminal=}'[match only on specified controlling terminals]: :_sequence _ttys -do'
   '(-U --uid)'{-U+,--uid=}'[match only on specified real user IDs]: :_sequence _users'
   '(-u --euid)'{-u+,--euid=}'[match only on specified effective user IDs]: :_sequence _users'
diff --git a/Completion/Unix/Command/_ping b/Completion/Unix/Command/_ping
index b371e808f..d36a0f3a9 100644
--- a/Completion/Unix/Command/_ping
+++ b/Completion/Unix/Command/_ping
@@ -191,7 +191,7 @@ case ${variant}:${${service#ping}:-4} in
       '-e[audible bell for each packet]'
       '-g[provide a visual display of packets received and lost]'
       '-T+[change TOS value]:TOS value:(critical inetcontrol lowdelay netcontrol throughput reliability ef af cs)'
-      '-V+[specify routing table to be used]:routing table'
+      '-V+[specify routing table to be used]:routing table:_routing_tables'
     )
   ;;
   iputils:*)
diff --git a/Completion/Unix/Command/_route b/Completion/Unix/Command/_route
index 06cca8d99..95df6d936 100644
--- a/Completion/Unix/Command/_route
+++ b/Completion/Unix/Command/_route
@@ -135,7 +135,7 @@ case $OSTYPE in
   openbsd*)
     subcmds+=( exec 'execute a command with alternate routing table' )
     args+=(
-      '-T+[select specified alternate routing table]:table id'
+      '-T+[select specified alternate routing table]:routing table:_routing_tables'
     )
     modifiers+=(
       -sa
diff --git a/Completion/Unix/Command/_top b/Completion/Unix/Command/_top
index af3deb6c7..692df790d 100644
--- a/Completion/Unix/Command/_top
+++ b/Completion/Unix/Command/_top
@@ -96,7 +96,7 @@ case $OSTYPE in
       '-C[show command arguments as well as process name]'
       '-g+[filter processes by the specified string]:string'
       '-o+[sort process display by the specified field]:field:->sortkey'
-      '-T+[filter processes by the specified routing table]:routing table'
+      '-T+[filter processes by the specified routing table]:routing table:_routing_tables'
       '-U+[filter processes by the specified user]: :_users -M "L\:|-="'
     );;
   darwin*)