From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 577 invoked from network); 15 Sep 2005 03:03:14 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 15 Sep 2005 03:03:14 -0000 Received: (qmail 56017 invoked from network); 15 Sep 2005 03:03:08 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 15 Sep 2005 03:03:08 -0000 Received: (qmail 16544 invoked by alias); 15 Sep 2005 03:03:00 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9419 Received: (qmail 16515 invoked from network); 15 Sep 2005 03:02:59 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 15 Sep 2005 03:02:59 -0000 Received: (qmail 54916 invoked from network); 15 Sep 2005 03:02:59 -0000 Received: from flock1.newmail.ru (212.48.140.157) by a.mx.sunsite.dk with SMTP; 15 Sep 2005 03:02:53 -0000 Received: (qmail 11581 invoked from network); 15 Sep 2005 02:52:43 -0000 Received: from unknown (HELO ?10.0.0.50?) (arvidjaar@newmail.ru@83.237.61.130) by smtpd.newmail.ru with SMTP; 15 Sep 2005 02:52:43 -0000 From: Andrey Borzenkov To: zsh-users@sunsite.dk Subject: Re: Context-sensitive completion args? Date: Thu, 15 Sep 2005 07:02:41 +0400 User-Agent: KMail/1.8.2 Cc: "Lusk, Andrew" References: <1D7B5D8FB046374991CF568E259E6D5F04E860E0@ex-mail-sea-02.ant.amazon.com> In-Reply-To: <1D7B5D8FB046374991CF568E259E6D5F04E860E0@ex-mail-sea-02.ant.amazon.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1729327.mr70vhSoqR"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200509150702.42369.arvidjaar@newmail.ru> X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) 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.0.4 --nextPart1729327.mr70vhSoqR Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Thursday 15 September 2005 05:59, Lusk, Andrew wrote: > I'd like to be able to complete one argument, with access to the completed > value of another argument. Like so: > > foocmd --arg1=3Da --arg2=3D > > and in the completion code for arg2, have access to the value of arg1 (a)= =2E=20 > Is this possible? > Yes, use _arguments function. It will parse the whole line and store existi= ng=20 arguments/values in hash opt_args. Something like _arguments \ "--arg1:arg1 description:(a b c)"\ "--arg2:arg2 decsription:_foocmd_arg2" function _foocmd_arg2 () { if [[ ${+opt_args[--foo2]} ]]; then local arg1=3D$opt_args[--arg1] ... do something with arg1 fi } if empty value is the same no value at all you may just skip check for key= =20 existence. HTH =2Dandrey --nextPart1729327.mr70vhSoqR Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQBDKORSR6LMutpd94wRAupjAKCQDnC4g+HvQJrqq7eUZvRp6VV49ACfcZbm EmC37Z/b8Mpo7WOaX5gtDW4= =04XU -----END PGP SIGNATURE----- --nextPart1729327.mr70vhSoqR--