zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: new completion function for arp
@ 2000-07-04 20:35 Oliver Kiddle
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Kiddle @ 2000-07-04 20:35 UTC (permalink / raw)
  To: Zsh workers

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
+



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PATCH: new completion function for arp
@ 2000-07-05 10:51 Sven Wischnowsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2000-07-05 10:51 UTC (permalink / raw)
  To: zsh-workers


Oliver Kiddle wrote:

> ...
> +
> +if [[ "$state" = hostintable ]]; then
> +  _wanted hosts expl 'host' compadd ${${${(f)"$(${words[1]} -a)"}##[ ?(]#}%%[ )]*}
> +fi
> +

This would return zero if _arguments returned non-zero without entering
the state.

Bye
 Sven

Index: Completion/User/_arp
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_arp,v
retrieving revision 1.1
diff -u -r1.1 _arp
--- Completion/User/_arp	2000/07/04 21:58:09	1.1
+++ Completion/User/_arp	2000/07/05 10:49:49
@@ -9,7 +9,6 @@
  '(-a -d -s 1)-f[read multiple entries from file]:file:_files' \
  '(-a)1:host:->hostintable' && return 0
 
-if [[ "$state" = hostintable ]]; then
+[[ "$state" = hostintable ]] &&
   _wanted hosts expl 'host' compadd ${${${(f)"$(${words[1]} -a)"}##[ ?(]#}%%[ )]*}
-fi
 

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-07-05 10:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-04 20:35 PATCH: new completion function for arp Oliver Kiddle
2000-07-05 10:51 Sven Wischnowsky

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).