From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18152 invoked from network); 21 Nov 2006 23:42:42 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.7 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 21 Nov 2006 23:42:42 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 20967 invoked from network); 21 Nov 2006 23:42:33 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 21 Nov 2006 23:42:33 -0000 Received: (qmail 15287 invoked by alias); 21 Nov 2006 23:42:24 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11013 Received: (qmail 15277 invoked from network); 21 Nov 2006 23:42:23 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 21 Nov 2006 23:42:23 -0000 Received: (qmail 19684 invoked from network); 21 Nov 2006 23:42:23 -0000 Received: from mtaout03-winn.ispmail.ntl.com (81.103.221.49) by a.mx.sunsite.dk with SMTP; 21 Nov 2006 23:42:19 -0000 Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com with ESMTP id <20061121234246.VOMG1865.mtaout03-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com> for ; Tue, 21 Nov 2006 23:42:46 +0000 Received: from pwslaptop.csr.com ([81.107.46.125]) by aamtaout04-winn.ispmail.ntl.com with ESMTP id <20061121234217.IDNC15733.aamtaout04-winn.ispmail.ntl.com@pwslaptop.csr.com> for ; Tue, 21 Nov 2006 23:42:17 +0000 Received: from pwslaptop.csr.com (pwslaptop.csr.com [127.0.0.1]) by pwslaptop.csr.com (8.13.8/8.13.7) with ESMTP id kALNg9m7006648 for ; Tue, 21 Nov 2006 23:42:12 GMT Message-Id: <200611212342.kALNg9m7006648@pwslaptop.csr.com> From: Peter Stephenson To: "zsh-users@sunsite.dk" Subject: Re: Problem with _arguments In-Reply-To: Message from "Nikolai Weibull" of "Tue, 21 Nov 2006 23:57:55 +0100." Date: Tue, 21 Nov 2006 23:42:09 +0000 "Nikolai Weibull" wrote: > Say that I have > > #compdef craptastic > > _arguments \ > '-s[omething]:with an argument' \ > '*:directory:_directories' > > Then, at least with my setup, if I have the following command line and > press I get: > > % craptastic -s > ::: with an argument ::: > > but if I have the following and press I get: > > % craptastic src -s > ::: with an argument ::: > ::: directory ::: > > Why is directory all of a sudden a viable option here? _arguments [ -nswWACRS ] [ -O name ] [ -M matchspec ] [ : ] spec ... This function can be used to give a complete specification for completion for a command whose arguments follow standard UNIX option and argument conventions. "Standard UNIX option and argument conventions" are that all options come before all non-option arguments. The GNU extension that they can occur in any order is not supported. So -s is an argument following the argument src. _arguments thinks src, -s and the argument you're now completing are normal arguments and hence completes directories. Offers to add the option for the GNU extension as an option to _arguments to be applied if POSIXLY_CORRECT isn't set will be gladly accepted. Volunteer must like murky code with limited comments. The ability to spend hours puzzling over why individual lines are written the way they are would be an advantage. -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/