summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Linux/Command/.distfiles2
-rw-r--r--Completion/Linux/Command/_ethtool141
-rw-r--r--Completion/Linux/Command/_ipset153
-rw-r--r--Completion/Unix/Command/_arp19
-rw-r--r--Etc/CONTRIBUTORS6
6 files changed, 317 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 61c2bc059..31947a466 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2008-06-24 Peter Stephenson <pws@csr.com>
+ * users/12985, users/12986, users/12988: Tomasz Pala:
+ Completion/Linux/Command/_ethtool,
+ Completion/Linux/Command/_ipset, Completion/Unix/Command/_arp:
+ new and updated completions.
+
* users/12987: Doc/Zsh/contrib.yo,
Functions/Zle/match-words-by-style,
Functions/Zle/select-word-style: add subword matching to
diff --git a/Completion/Linux/Command/.distfiles b/Completion/Linux/Command/.distfiles
index ff98cca82..f3ef3cadf 100644
--- a/Completion/Linux/Command/.distfiles
+++ b/Completion/Linux/Command/.distfiles
@@ -4,7 +4,9 @@ _acpi
_analyseplugin
_acpitool
_brctl
+_ethtool
_fusermount
+_ipset
_iptables
_iwconfig
_losetup
diff --git a/Completion/Linux/Command/_ethtool b/Completion/Linux/Command/_ethtool
new file mode 100644
index 000000000..50ab9f741
--- /dev/null
+++ b/Completion/Linux/Command/_ethtool
@@ -0,0 +1,141 @@
+#compdef ethtool
+
+local -a cmds
+
+if [[ $CURRENT -ge 4 ]]; then
+ case $words[CURRENT-1]; in
+ rx|tx)
+ if [[ $words[2] = '-G' ]] && _message -e n 'number of ring entries' || _wanted -x onoff expl 'enabled' compadd off on
+ ;;
+ autoneg|adaptive-rx|adaptive-tx|raw|sg|tso)
+ _wanted -x onoff expl 'enabled' compadd off on
+ ;;
+ rx-usecs|rx-frames|rx-usecs-irq|rx-frames-irq|tx-usecs|tx-frames|tx-usecs-irq|tx-frames-irq|stats-block-usecs|pkt-rate-low|rx-usecs-low|rx-frames-low|tx-usecs-low|tx-frames-low|pkt-rate-high|rx-usecs-high|rx-frames-high|tx-usecs-high|tx-frames-high|sample-interval|rx-mini|rx-jumbo|offset|length|magic|value|phyad|msglvl)
+ _message -e n 'number'
+ ;;
+ speed)
+ _wanted -x speed expl 'speed' compadd 10 100 1000
+ ;;
+ duplex)
+ _wanted -x duplex expl 'duplex mode' compadd half full
+ ;;
+ port)
+ _wanted -x port expl 'device port' compadd tp aui bnc mii
+ ;;
+ xcvr)
+ _wanted -x xcvr expl 'transceiver type' compadd internal external
+ ;;
+ wol)
+ _values -s '' 'Wake-on-LAN options' \
+ '(d)p[Wake on phy activity]' \
+ '(d)u[Wake on unicast messages]' \
+ '(d)m[Wake on multicast messages]' \
+ '(d)b[Wake on broadcast messages]' \
+ '(d)a[Wake on ARP]' \
+ '(d)g[Wake on MagicPacket(tm)]' \
+ '(d)s[Enable SecureOn(tm) password for MagicPacket(tm)]' \
+ '(p u m b a g s)d[Disable (wake on nothing)]'
+ ;;
+ sopass)
+ _message -e secureon 'password - 6 bytes in ethernet MAC hex format (xx:yy:zz:aa:bb:cc)'
+ ;;
+ *)
+ case $words[2]; in
+ -A)
+ _values -S ' ' -w 'pause options' \
+ 'autoneg[Specify if pause autonegotiation is enabled]' \
+ 'rx[Specify if RX pause is enabled]' \
+ 'tx[Specify if TX pause is enabled]'
+ ;;
+ -C)
+ _values -S ' ' -w 'coalescing settings' \
+ 'adaptive-rx' 'adaptive-tx' \
+ 'rx-usecs' 'rx-frames' 'rx-usecs-irq' 'rx-frames-irq' \
+ 'tx-usecs' 'tx-frames' 'tx-usecs-irq' 'tx-frames-irq' \
+ 'stats-block-usecs' \
+ 'pkt-rate-low' \
+ 'rx-usecs-low' 'rx-frames-low' \
+ 'tx-usecs-low' 'tx-frames-low' \
+ 'pkt-rate-high' \
+ 'rx-usecs-high' 'rx-frames-high' \
+ 'tx-usecs-high' 'tx-frames-high' \
+ 'sample-interval'
+ ;;
+ -G)
+ _values -S ' ' -w 'ring parameters' \
+ 'rx[Change number of ring entries for the RX ring]' \
+ 'rx-mini[Change number of ring entries for the RX Mini ring]' \
+ 'rx-jumbo[Change number of ring entries for the RX Jumbo ring]' \
+ 'tx[Change number of ring entries for the TX ring]'
+ ;;
+ -d)
+ _values -S ' ' -w 'register dump options' \
+ 'raw[dump raw register data]'
+ ;;
+ -e)
+ _values -S ' ' -w 'EEPROM dump options' \
+ 'raw[dump raw EEPROM data]' \
+ 'offset[dump certain portions of the EEPROM]' \
+ 'length[dump certain portions of the EEPROM]'
+ ;;
+ -E)
+ _values -S ' ' -w 'EEPROM values' \
+ 'magic[device-specific key]' \
+ 'offset[select byte]' \
+ 'value[new value]'
+ ;;
+ -K)
+ _values -S ' ' -w 'offload options' \
+ 'rx[Specify if RX checksumming is enabled]' \
+ 'tx[Specify if TX checksumming is enabled]' \
+ 'sg[Specify if scatter-gather is enabled]' \
+ 'tso[Specify if tcp segmentation offload is enabled]'
+ ;;
+ -p)
+ if [[ $CURRENT -eq 4 ]] && _message -e length 'seconds'
+ ;;
+ -t)
+ _values -S ' ' -w 'selftest option' \
+ '(online)offline:perform full set of tests possibly causing normal operation interruption (default)]' \
+ '(offline)online:perform limited set of tests do not interrupting normal adapter operation]'
+ ;;
+ -s)
+ _values -S ' ' -w 'change setting' \
+ 'speed[Set speed in Mb/s]' \
+ 'duplex[Set full or half duplex mode]' \
+ 'port[Select device port]' \
+ 'autoneg[Specify if autonegotiation is enabled]' \
+ 'phyad[PHY address]' \
+ 'xcvr[Select transceiver type]' \
+ 'wol[Set Wake-on-LAN options]' \
+ 'sopass[Set the SecureOn(tm) password]' \
+ 'msglvl[Set the driver message level]'
+ ;;
+ esac
+ ;;
+ esac
+fi
+
+cmds=(-h -a -A -c -C -g -G -i -d -e -E -k -K -p -r -S -t -s)
+
+_arguments \
+ "($cmds)1:interface:_net_interfaces" \
+ "($cmds 1)-h[shows a short help message]" \
+ "($cmds)-a[queries the specified ethernet device for pause parameter information]" \
+ "($cmds)-A[change the pause parameters of the specified ethernet device]" \
+ "($cmds)-c[queries the specified ethernet device for coalescing information]" \
+ "($cmds)-C[change the coalescing settings of the specified ethernet device]" \
+ "($cmds)-g[queries the specified ethernet device for RX/TX ring parameter information]" \
+ "($cmds)-G[change the RX/TX ring parameters of the specified ethernet device]" \
+ "($cmds)-i[queries the specified ethernet device for associated driver information]" \
+ "($cmds)-d[retrieves and prints a register dump for the specified ethernet device]" \
+ "($cmds)-e[retrieves and prints an EEPROM dump for the specified ethernet device]" \
+ "($cmds)-E[Changes EEPROM byte for the specified ethernet device]" \
+ "($cmds)-k[queries the specified ethernet device for offload information]" \
+ "($cmds)-K[change the offload parameters of the specified ethernet device]" \
+ "($cmds)-p[initiates adapter-specific action intended to identify the adapter by sight]" \
+ "($cmds)-r[restarts auto-negotiation on the specified ethernet device]" \
+ "($cmds)-S[queries the specified ethernet device for NIC- and driver-specific statistics]" \
+ "($cmds)-t[executes adapter selftest on the specified ethernet device]" \
+ "($cmds)-s[allows changing some or all settings of the specified ethernet device]" \
+ '*:' && ret=0
diff --git a/Completion/Linux/Command/_ipset b/Completion/Linux/Command/_ipset
new file mode 100644
index 000000000..36d269f2c
--- /dev/null
+++ b/Completion/Linux/Command/_ipset
@@ -0,0 +1,153 @@
+#compdef ipset
+
+local offset=0
+local -a args from_to hash cmds listopts
+
+_set_types () {
+ _values -S \ "Set type" \
+ 'ipmap[Up to 65536 IP addresses]' \
+ 'macipmap[Up to 65536 IP addresses with MAC]' \
+ 'portmap[Up to 65536 ports]' \
+ 'iphash[Hash of IP addresses]' \
+ 'nethash[Hash of network addresses]' \
+ 'ipporthash[Hash of IP address and port pairs]' \
+ 'iptree[Tree of IP addresses, optionally with timeout]'
+}
+
+if [[ $words[2] = (-q|--quiet) ]]; then
+ offset=1
+fi
+
+_ipsets () {
+ local -a vals
+ vals=( ${${(M)${(f)"$(_call_program ipsets ipset -nL)"}%Name: *}#Name: } )
+ _describe -t ipsets "IP sets" vals
+}
+_sets () {
+ _ipsets
+ local -a vals
+ case $words[offset+2]; in
+ -X|--destroy)
+ vals=('\:all\::remove all not referenced sets')
+ ;;
+ -F|--flush)
+ vals=('\:all\::flush all sets')
+ ;;
+ -L|--list|-nL|-sL|-nsL|-snL|-n|-s|-ns|-sn)
+ vals=('\:all\::list all sets')
+ ;;
+ -S|--save)
+ vals=('\:all\::save all sets')
+ esac
+ _describe -t special_values "special values" vals
+}
+
+from_to=('(--network)--from[from IP or network (with --netmask)]:IP'
+ '(--network)--to[to IP or network (with --netmask)]:IP'
+ '(--from --to)--network[network]:IP/mask'
+)
+hash=( '--hashsize[The initial hash size (default 1024)]:hash size'
+ '--probes[Max number of tries to resolve clashing (default 8)]:probes'
+ '--resize[Ratio of increasing hash size after unsuccessful <probes> number of double-hashing]:percent'
+)
+
+case $words[offset+2]; in
+ -N|--create)
+ case $words[offset+4]; in
+ ipmap)
+ args=( $from_to
+ '--netmask[store network addresses instead of IP addresses]:CIDR'
+ )
+ ;;
+ macipmap)
+ args=( $from_to
+ '--matchunset[Always match IP addresses which could be stored in the set but are not]'
+ )
+ ;;
+ portmap)
+ args=( '--from[from port]:port:_ports'
+ '--to[to port]:port:_ports'
+ )
+ ;;
+ iphash)
+ args=( $hash
+ '--netmask[store network addresses instead of IP addresses]:CIDR'
+ )
+ ;;
+ nethash)
+ args=( $hash )
+ ;;
+ ipporthash)
+ args=( $from_to $hash )
+ ;;
+ iptree)
+ args=( '--timeout[Timeout value for the entries in seconds (default 0)]:timeout' )
+ ;;
+ esac
+ ;;
+ -T|--test)
+ args=( '(-b --binding)'{-b,--binding}'[Test wether '$words[offset+4]' points to the specified binding]:::_ipsets' )
+ ;;
+ -B|--bind)
+ args=( '(-b --binding)'{-b,--binding}'[Value of the binding]:::_ipsets' )
+ ;;
+esac
+
+_ips () {
+ if [[ $CURRENT -eq ((offset+4)) ]]; then
+ local ips=1 default
+ local -a vals vals1 vals2 bindings
+ vals=( ${${${(f)"$(_call_program ipsets ipset -nL $words[offset+3])"}[4,-1]}//\:/\\:} )
+ for i in $vals; do
+ if [[ $i = Default\ binding\\:* ]]; then default=${i#Default binding\\: }; continue; fi
+ if [[ $i = (Header\\:*|Members\\:) ]]; then continue; fi
+ if [[ $i = 'Bindings\:' ]]; then ips=0; continue; fi
+ if (( $ips )); then vals1+=$i; else bindings+=${i/ ->/:}; fi
+ done
+ case $words[offset+2]; in
+ -T|--test)
+ vals2=('\:default\::test default binding of the set for --binding')
+ ;;
+ -B|--binding)
+ vals2=('\:default\::set default binding of the set')
+ ;;
+ -U|--unbind)
+ vals1=()
+ vals2=('\:all\::destroy the bindings of all elements of a set')
+ if [[ -n "$default" ]]; then
+ vals2+=("\:default\::remove default binding of the set to '$default'")
+ fi
+ _describe -t ipb "IPs from $words[offset+3] set with bindings" bindings
+ ;;
+ esac
+ _describe -t ips "IPs from $words[offset+3] set" vals1
+ _describe -t special_values "special values" vals2
+ fi
+}
+
+cmds=(-N -X -F -E -W -S -R -A -D -T -B -U -H --create --destroy --flush --rename --swap --save --restore --add --del --test --bind --unbind --help)
+listopts=(-n --numeric -s --sorted -L --list -nL -sL -nsL -snL -ns -sn)
+
+_arguments \
+ "($cmds $listopts)"{-N,--create}'[Create a set]:set name::::_set_types' \
+ "($cmds $listopts)"{-X,--destroy}'[Destroy specified set (or all if none specified)]:set name:_sets' \
+ "($cmds $listopts)"{-F,--flush}'[Flush specified set (or all if none specified)]:set name:_sets' \
+ "($cmds $listopts)"{-E,--rename}'[rename set]:current set name:_ipsets:new set name:' \
+ "($cmds $listopts)"{-W,--swap}'[swap two sets]:::_ipsets:::_ipsets' \
+ "($cmds -L --list -q --quiet -nL -sL -nsL -snL)"{-L,--list}'[List the entries and bindings for the specified set (or all if none specified)]:::_sets' \
+ "($cmds -L --list -q --quiet -n --numeric -snL -nsL -sL -ns -sn)"-nL'[List the entries and bindings for the specified set (or all if none specified) \- numeric output]:::_sets' \
+ "($cmds -L --list -q --quiet -s --sorted -snL -nsL -nL -ns -sn)"-sL'[List the entries and bindings for the specified set (or all if none specified) \- sorted output]:::_sets' \
+ "($cmds $listopts -q --quiet)"{-nsL,-snL}'[List the entries and bindings for the specified set (or all if none specified) \- sorted numeric output]:::_sets' \
+ "($cmds $listopts)"{-S,--save}'[Save the given set (or all if none specified)]:::_sets' \
+ "($cmds $listopts)"{-R,--restore}'[Restore a saved session generated by --save from stdin]' \
+ "($cmds $listopts)"{-A,--add}'[Add an IP to a set]:::_ipsets:IP' \
+ "($cmds $listopts)"{-D,--del}'[Delete an IP from a set]:::_ipsets:::_ips' \
+ "($cmds $listopts)"{-T,--test}'[Test wether an IP is in a set or the IP points to the specified binding]:::_ipsets:::_ips' \
+ "($cmds $listopts)"{-B,--bind}'[Bind the IP in setname to to-setname]:::_ipsets:::_ips' \
+ "($cmds $listopts)"{-U,--unbind}'[Delete the binding belonging to IP in set setname]:::_ipsets:::_ips' \
+ "($cmds $listopts)"{-H,--help}'[Print help and settype specific help if settype specified]:::_set_types' \
+ "(-q --quiet $listopts)"{-q,--quiet}'[Suppress any output to stdout and stderr]' \
+ "($cmds -s --sorted -q --quiet -sL -nsL -snL -ns -sn)"{-s,--sorted}'[Sorted output]' \
+ "($cmds -n --numeric -q --quiet -nL -nsL -snL -ns -sn)"{-n,--numeric}"[Numeric output; don't resolve host names, network names and services]" \
+ "($cmds -ns -sn -q --quiet -nL -sL -nsL -snL -n --numeric -s --sorted)"{-ns,-sn}'[Sorted numeric output]' \
+ "$args[@]"
diff --git a/Completion/Unix/Command/_arp b/Completion/Unix/Command/_arp
index b46d2daf0..d9b033e90 100644
--- a/Completion/Unix/Command/_arp
+++ b/Completion/Unix/Command/_arp
@@ -1,14 +1,21 @@
#compdef arp
local state line expl curcontext="$curcontext"
+local -a cmds
+
+cmds=(-a --display -d --delete -s --set -f --file)
_arguments -C \
- '(-d -s -f 1)-a[show entries for all or specified hosts]:host:->hostintable' \
- '(-a -s -f 1)-d[delete entry from table]:host:->hostintable' \
- '(-a -d -f 1)-s[create an arp entry]:host:_hosts:ethernet address::*:option:(temp trail pub)' \
- '(-a -d -s 1)-f[read multiple entries from file]:file:_files' \
+ "($cmds 1 -D --use-device)"{-a,--display}'[show entries for all or specified hosts]:host:->hostintable' \
+ "($cmds 1 -n --numeric -D --use-device -H --hw-type)"{-d,--delete}'[delete entry from table]:host:->hostintable' \
+ "($cmds 1 -n --numeric)"{-s,--set}'[create an ARP entry]:host:_hosts:ethernet address::*:option:(temp trail pub)' \
+ "($cmds 1 -n --numeric)"{-f,--file}'[read multiple entries from file]:file:_files' \
+ '(-i --device)'{-i,--device}'[Select an interface]:::_net_interfaces:' \
+ '(-D --use-device -a --display -d --delete)'{-D,--use-device}"[Use the interface ifa's hardware address]" \
+ '(-H --hw-type -d --delete)'{-H,--hw-type}'[class of entries to check for]:class:(ether arcnet pronet ax25 netrom)' \
+ '(-n --numeric -d --delete -s --set -f --file)'{-n,--numeric}'[shows numerical addresses]' \
+ '(-v --verbose)'{-v,--verbose}'[be verbose]' \
'(-a)1:host:->hostintable'
[[ "$state" = hostintable ]] &&
- _wanted hosts expl 'host' compadd ${${${(f)"$(${words[1]} -a)"}##[ ?(]#}%%[ )]*}
-
+ _wanted hosts expl 'host' compadd ${${${(f)"$(${words[1]} -an)"}##[ ?(]#}%%[ )]*}
diff --git a/Etc/CONTRIBUTORS b/Etc/CONTRIBUTORS
index bbb6f6898..09713d76e 100644
--- a/Etc/CONTRIBUTORS
+++ b/Etc/CONTRIBUTORS
@@ -26,9 +26,9 @@ Takimoto Jun, River Tarnell, Philippe Troin, Geoff Wing, Matt Wozniski.
Contributors to completion functions include those above plus Zack Cerza,
Danek Duvall, Tobias Gruetzmacher, Dough Kearns, Hannu Koivisto, Henryk
-Konsek, Scott Murray, Carlos Phillips, Haakon Riiser, Felix Rosencrantz,
-Stephen Rüger, Kris Shannon, Travis Spencer, Mĺrten Svantesson, Motoi
-Washida, Jess Weinstein.
+Konsek, Scott Murray, Tomasz Pala, Carlos Phillips, Haakon Riiser, Felix
+Rosencrantz, Stephen Rüger, Kris Shannon, Travis Spencer, Mĺrten
+Svantesson, Motoi Washida, Jess Weinstein.
Version 4.2
-----------