From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4017 invoked from network); 11 Feb 2009 18:41:09 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 11 Feb 2009 18:41:09 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 62072 invoked from network); 11 Feb 2009 18:41:02 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 11 Feb 2009 18:41:02 -0000 Received: (qmail 12832 invoked by alias); 11 Feb 2009 18:40:55 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26553 Received: (qmail 12819 invoked from network); 11 Feb 2009 18:40:54 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 11 Feb 2009 18:40:54 -0000 Received: from mail-fx0-f20.google.com (mail-fx0-f20.google.com [209.85.220.20]) by bifrost.dotsrc.org (Postfix) with ESMTP id 2BD3280271F0 for ; Wed, 11 Feb 2009 19:40:50 +0100 (CET) Received: by fxm13 with SMTP id 13so970162fxm.21 for ; Wed, 11 Feb 2009 10:40:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :user-agent:references:in-reply-to:mime-version:content-type :content-transfer-encoding:message-id; bh=G1PBWgsyh2XZPKlylfj4Ymd5s/kPCCFJUE5dau39UlA=; b=sg3ybpp1Qz8bko1yH+NRJ1kjKJ00exH2pHPK9Emu1upKsQxIVKuWSYyZYOh1naeTlQ woGsHPJOPaclG/zZLCDHWQEgZLZ1Gvd/T+hahmVhom8bvre0qGd1LiGcToZFHxpqlBDx GqRZU/T+hGBzuhAX7RASrSyuzvaN5mWSWEPmU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:references:in-reply-to:mime-version :content-type:content-transfer-encoding:message-id; b=jQo7iovnZsiqC9aNOAQN35B4nRv+HLVEGNrEwWZ15BHfOe0wneTrV2gdwmBsvdSXGo K/fFs4+YZkOe/eVxD1K4NaFcfbrkqNJOiDwMF5VhzyVwa/YAFSkQnaVogyRr0WS9z3W7 LPCNw+gv8drJ4Vw3EwZYeyowlEaYEMZDADVgk= Received: by 10.103.220.18 with SMTP id x18mr1349202muq.135.1234377650467; Wed, 11 Feb 2009 10:40:50 -0800 (PST) Received: from cooker.localnet (ppp91-77-253-212.pppoe.mtu-net.ru [91.77.253.212]) by mx.google.com with ESMTPS id n10sm1330250mue.39.2009.02.11.10.40.09 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 11 Feb 2009 10:40:22 -0800 (PST) From: Andrey Borzenkov To: Danek Duvall , zsh-workers@sunsite.dk Subject: Re: completion based on context earlier in the line Date: Wed, 11 Feb 2009 21:39:50 +0300 User-Agent: KMail/1.11.0 (Linux/2.6.29-rc4-1avb; KDE/4.2.0; i686; ; ) References: <20090211182808.GA20929@lorien.comfychair.org> In-Reply-To: <20090211182808.GA20929@lorien.comfychair.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart5808840.EPMLH2cqJn"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200902112139.52429.arvidjaar@gmail.com> X-Virus-Scanned: ClamAV 0.92.1/8980/Wed Feb 11 17:40:45 2009 on bifrost X-Virus-Status: Clean --nextPart5808840.EPMLH2cqJn Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline On 11 of February 2009 21:28:08 Danek Duvall wrote: > I'm having trouble figuring out how to do this. I've got a command, > "svccfg", which can look roughly like: > > svccfg -s describe > > I'm trying to figure out how to complete , but it has to be > based on , and I've no idea how to get the value of > to the property completion function. > > My _svccfg looks roughly like this (the full thing is in the zsh > distro): > > if [[ $service == "svccfg" ]]; then > _arguments -s \ > '-s[FMRI on which to operate]:fmri:_svcs_fmri -c' \ > \ > '*::command:->subcmd' && return 0 > > if (( CURRENT == 1 )); then > _wanted > return > fi > > service="$words[1]" > curcontext=... > fi > > case $service in > (describe) > _arguments -A "-*" \ > ":property:_smf_properties" > > So I want to extract the argument to -s (if it exists) and pass it to > _smf_properties down below. But I don't know how. You probably could use opt_args array: In addition to $state, _arguments also sets the global parameters `context', `line' and `opt_args' as described below, and does not reset any changes made to the special parameters such as PREFIX and words. This gives the calling function the choice of resetting these parameters or propagating changes in them. During the performance of the action the array `line' will be set to the command name and normal arguments from the command line, i.e. the words from the command line excluding all options and their arguments. Options are stored in the associative array `opt_args' with option names as keys and their arguments as the values. For options that have more than one argument these are given as one string, separated by colons. All colons in the original arguments are preceded with backslashes. --nextPart5808840.EPMLH2cqJn Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEABECAAYFAkmTG3gACgkQR6LMutpd94zpgACeJM4mH0yTqM/B7bNRqnQgnrwP B6kAoISQJcn0/3xBQ+addJ6/pjF2TDwz =e7GB -----END PGP SIGNATURE----- --nextPart5808840.EPMLH2cqJn--