From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-users-return-23723-ml=inbox.vuxu.org@zsh.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id bb22fbf2 for ; Thu, 25 Oct 2018 20:42:25 +0000 (UTC) Received: (qmail 1798 invoked by alias); 25 Oct 2018 20:42:14 -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: List-Unsubscribe: X-Seq: 23723 Received: (qmail 15386 invoked by uid 1010); 25 Oct 2018 20:42:14 -0000 X-Qmail-Scanner-Diagnostics: from mail-it1-f171.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.166.171):SA:0(-1.9/5.0):. Processed in 3.398052 secs); 25 Oct 2018 20:42:14 -0000 X-Envelope-From: dana@dana.is X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=2zfddz328m/hhaTx2Rtq892CetKeSk8XentEspl4qBA=; b=vMF6Bw4c/IzGj6KQSD+PwI8NyWnbksJILKG6iqxMBqincnAmRLZc/ytFDqUBwxXwWi eCk2YSfBm+XVNJZ58B7W/UehgEA/MTXNan9fHnfFoO0LmM6LL0J/WP71nrOULvTb1TvF fjsO3pG5n+LEwXd1msnv5wSCgogsVhJ9ktP7hfYYqNl+EJwkE2hycZtAXzVDYH3CPQ5d BWbSRPZCl0ve1o6C3xsVdv3PXVj6cP4CuPlHfvUiJg9KNdOOJbXYXCptK5BkvS022KD8 6OogIopoSXAa5Dq/Hp8DMaDkOQAUp7IGVqVdxOfK00fOPA/NWrKLdI9ORr/r9Y9k9EiA ixiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=2zfddz328m/hhaTx2Rtq892CetKeSk8XentEspl4qBA=; b=FCXfaOE6PoiIlz0WXMSjVinb3w57CqIA9U8xMgsLVhLR1k0O/GMczK4Y2fT/foWegp UI+MGuqfkGZGiqtMHPtqeMMlWjM4DLw7LtWLcvoRFCcYnMWqQWpA9x0FYSDObxTgdeW7 XTMNsctFccsuUJrV+h3qLQKiCtGpjkwJuqxwqbpcbWO67oqwT8PHMw8kp1iA/VzRx9OY x6g4CzLbEJF+L/TdtXsZiHgBR5Bj3qoqdlqbBx96RiArBrAC2G1h/oed2Hbo3gjr048D 0YQ7A90icw00Tks3SNVmbcpgQ355o7cUXBNe5Sj782M0mWCIx4hyBP8ck1hIJsL9gjlP 7W2g== X-Gm-Message-State: AGRZ1gLvDsT9j4tBcouLbZxr69FCnOgoatwjONoQ1rsF6tTf6SpDFg4c NnSfm6/AJDvcmNQ2X/zVT/48lw== X-Google-Smtp-Source: AJdET5fn6FXrHWGyTEzFikEtP9GAOBJmUbmI2QJqbymTWviqA+bpC6lU85Lhh9w3h+xIYmdhrCC1ew== X-Received: by 2002:a24:d707:: with SMTP id y7-v6mr2045829itg.65.1540500127821; Thu, 25 Oct 2018 13:42:07 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: Filtering array on index From: dana In-Reply-To: Date: Thu, 25 Oct 2018 15:42:06 -0500 Cc: =?utf-8?Q?Jesper_Nyg=C3=A5rds?= , Zsh Users Content-Transfer-Encoding: quoted-printable Message-Id: <63A34262-4216-4AFD-93B6-035CCEE44908@dana.is> References: To: Bart Schaefer X-Mailer: Apple Mail (2.3445.9.1) On 25 Oct 2018, at 15:21, Bart Schaefer = wrote: >% zparseopts -a vees v+:: >... >% print -lr -- ${vees#-v} That method is the one i've seen used to solve this problem in = completion functions. But you have to make sure to add - at the end of the option = spec if you want it to work with mandatory (single-colon) arguments: >An optional argument is put into the same array element as the option = name >(note that this makes empty strings as arguments indistinguishable). A >mandatory argument is added as a separate element unless the =E2=80=98:-=E2= =80=99 form is used, >in which case the argument is put into the same element. So if the argument to -v is mandatory you'd just use v+:- as the spec dana