From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19113 invoked from network); 9 Jul 2005 07:03:15 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 9 Jul 2005 07:03:15 -0000 Received: (qmail 46798 invoked from network); 9 Jul 2005 07:03:09 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 9 Jul 2005 07:03:09 -0000 Received: (qmail 15445 invoked by alias); 9 Jul 2005 07:03:02 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9067 Received: (qmail 15436 invoked from network); 9 Jul 2005 07:03:01 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 9 Jul 2005 07:03:01 -0000 Received: (qmail 45705 invoked from network); 9 Jul 2005 07:03:01 -0000 Received: from vms048pub.verizon.net (206.46.252.48) by a.mx.sunsite.dk with SMTP; 9 Jul 2005 07:02:56 -0000 Received: from candle.brasslantern.com ([71.116.88.149]) by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IJC00IRVM8P2V2D@vms048.mailsrvcs.net> for zsh-users@sunsite.dk; Sat, 09 Jul 2005 02:02:50 -0500 (CDT) Received: from candle.brasslantern.com (IDENT:schaefer@localhost [127.0.0.1]) by candle.brasslantern.com (8.12.11/8.12.11) with ESMTP id j6972mw3017164 for ; Sat, 09 Jul 2005 00:02:48 -0700 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id j6972mqa017163 for zsh-users@sunsite.dk; Sat, 09 Jul 2005 00:02:48 -0700 Date: Sat, 09 Jul 2005 07:02:47 +0000 From: Bart Schaefer Subject: Re: Help with completion of option arguments In-reply-to: To: zsh-users@sunsite.dk Message-id: <1050709070248.ZM17162@candle.brasslantern.com> MIME-version: 1.0 X-Mailer: Z-Mail (5.0.0 30July97) Content-type: text/plain; charset=us-ascii References: Comments: In reply to Travis Spencer "Help with completion of option arguments" (Jul 8, 12:06am) X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 On Jul 8, 12:06am, Travis Spencer wrote: } Subject: Help with completion of option arguments } } I have a command for which I'm trying to write a completion widget. } } _arguments -C \ } "-A-[this is a test]:test:((a\:'test sub-message'))" } "-B-[notify (e-mail) admins]:notify:(( } b\:'suppress interactive query (for use in crontab)'))" This wouldn't work as written, because you left off the backslash on the second line, and because -A is an *option of* _arguments, so it is necessary to use _arguments -C : "-A-..." in order to get "-A-..." to be treated as an *argument* of _arguments. I mention this to point out that it's almost always better to show the real example you're working with, rather than attempt to make up an equivalent one. The exception would be when you're showing a minimal test case for a bug, but then you should have tried the example to be sure it demonstrates what you intend it to. By the way, does your call to _arguments use the ->state mechanism at any point? If not, you don't need the -C in there. } The command has options that take arguments that must follow the } option without any white space. For example, the command takes } options such as these: `-A', `-Aa', `-B', and `-Bb'. } } But the problem is, with only a single argument like this, after } typing `-A' or `-B', the sole completion `a' and `b' are run rather } than outputting the descriptions. I interpret this to mean that you're trying to use the completion as a sort of interactive help lookup ("I don't remember what -A does, please tell me"). If that's what you want, don't press TAB to complete further; rather, type ctrl-d (or whatever you have bound to list-choices) to show the possible alternatives. However, the literal answer to your question ... } Is there some way to get _arguments to output the messages `test } sub-message' and `suppress interactive query (for use in crontab)' } when `-A' or `-B' have been input rather than completing them } directly? ... is, insert an empty string element into the double-parens like this: _arguments : \ "-A-[this is a test]:test:(('' a\:'test sub-message'))" \ "-B-[notify (e-mail) admins]:notify:(('' b\:'suppress interactive query (for use in crontab)'))"