From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23174 invoked by alias); 16 Jan 2013 09:54:18 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17570 Received: (qmail 16586 invoked from network); 16 Jan 2013 09:54:16 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.223.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=7r7RPDhVOBzOVixTLuC4WGC7hoTwSbDZLXGMWQ+iQsM=; b=MAbZgwm4a0hU1+g00RBEHwIhQs8Orn8lSUR1S33N6kev54AFu1ovmrVEs+Hl/gfgOl 8Ec1ctex5oI/Un+1Bc8xnUyfTkapcC6c8rc8hYsDHcOjQyOKTIBQ6IK/hk492ml0dy7n a4DibN+HJirDJDVapZI/OQmKn0z1clCDb2R0UAZQZqr5alDPtaKYYyQWU3GjBkTFW6SZ 3Ff71/Ki+Zv6Wd5WkkhpdQTnA6PSVQ4HCHqLu47nLLUevv76kPOzzSLN0qXi/vgj1YbE rfe6Fo0IbexuJaQnsp4IQTWsbn67HcCULTiCXz3oZgp+CLJQl62sprz337JgHs2S+RCP slHA== MIME-Version: 1.0 X-Received: by 10.50.16.144 with SMTP id g16mr383531igd.2.1358329630023; Wed, 16 Jan 2013 01:47:10 -0800 (PST) Date: Wed, 16 Jan 2013 10:47:09 +0100 Message-ID: Subject: Setting state in _arguments From: =?ISO-8859-1?Q?Jesper_Nyg=E5rds?= To: zsh-users@zsh.org Content-Type: multipart/alternative; boundary=f46d044305ce15e17304d364c35c --f46d044305ce15e17304d364c35c Content-Type: text/plain; charset=ISO-8859-1 I am trying to improve the completion for the gradle command, and have run into something I cannot explain. To simplify things as much as possible, I have constructed this example file, calling it _myfoo: #compdef myfoo local curcontext="$curcontext" ret=1 state _arguments -C \ '--option1' \ '--option2' \ '*:a subcommand:->subcommand' \ && ret=0 if [[ -n $state ]]; then print state: $state > /dev/pty2 fi return ret On the command line, I write: "myfoo --", and the completion kicks in and gives me the options "--option1" and "--option2", which is what I expected. However, on /dev/pty2 I see "state: subcommand", which I did NOT expect. I would have thought that since only "--option1" or "--option2" could possibly match after "--", state would not have been set*, *but it is. The trouble with this is that in the gradle completion, the possible subcommands are generated inside the if statement in this case, and thatis time consuming. I would thus like to avoid going into it when the "--" on the command line indicates that an option should be completed. I would have thought that the call to _arguments did not set state since found some matching options, but obviously I am using it incorrectly. What should I do instead? --f46d044305ce15e17304d364c35c--