From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16325 invoked from network); 4 Jul 2000 21:53:28 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 4 Jul 2000 21:53:28 -0000 Received: (qmail 9371 invoked by alias); 4 Jul 2000 21:53:17 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12165 Received: (qmail 9364 invoked from network); 4 Jul 2000 21:53:15 -0000 Sender: opk Message-ID: <39624AAC.E4A7530@u.genie.co.uk> Date: Tue, 04 Jul 2000 21:35:56 +0100 From: Oliver Kiddle X-Mailer: Mozilla 4.73 [en] (X11; I; Linux 2.2.16 i586) X-Accept-Language: en MIME-Version: 1.0 To: Zsh workers Subject: PATCH: new completion function for arp Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 +