zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@u.genie.co.uk>
To: Zsh workers <zsh-workers@sunsite.auc.dk>
Subject: PATCH: new completion function for arp
Date: Tue, 04 Jul 2000 21:35:56 +0100	[thread overview]
Message-ID: <39624AAC.E4A7530@u.genie.co.uk> (raw)

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
+



             reply	other threads:[~2000-07-04 21:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-04 20:35 Oliver Kiddle [this message]
2000-07-05 10:51 Sven Wischnowsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=39624AAC.E4A7530@u.genie.co.uk \
    --to=opk@u.genie.co.uk \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).