Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: new completion function for arp



arp varies a little between systems but this handles the main options
which are fairly common to the OSes I've tried. When completing hosts
from the ARP table, it uses the IP address for any unresolved hosts
(which I think is the most useful behaviour) despite the fact that the
arp command will accept the IP address for any host. I could make it
complete both and use styles to configure it but I don't think arp is
used enough for that to be worth the effort.

Oliver

--- /dev/null	Thu Jun  8 23:42:50 2000
+++ Completion/User/_arp	Tue Jul  4 21:34:03 2000
@@ -0,0 +1,15 @@
+#compdef arp
+
+local state line expl curcontext="$curcontext"
+
+_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' \
+ '(-a)1:host:->hostintable' && return 0
+
+if [[ "$state" = hostintable ]]; then
+  _wanted hosts expl 'host' compadd ${${${(f)"$(${words[1]} -a)"}##[ ?(]#}%%[ )]*}
+fi
+




Messages sorted by: Reverse Date, Date, Thread, Author