From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-users-return-23725-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=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,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 92a5cd35 for ; Fri, 26 Oct 2018 08:00:15 +0000 (UTC) Received: (qmail 22804 invoked by alias); 26 Oct 2018 07:59:59 -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: 23725 Received: (qmail 28660 invoked by uid 1010); 26 Oct 2018 07:59:59 -0000 X-Qmail-Scanner-Diagnostics: from mail-lf1-f47.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.167.47):SA:0(-1.9/5.0):. Processed in 1.783181 secs); 26 Oct 2018 07:59:59 -0000 X-Envelope-From: jesper.nygards@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=/A0F8H+4YUeZ6ve74shsldlyLPQTpjrEfoievMlFmh0=; b=n/XWkdwxHZ5SEWp3OnGBhyYSfV48f9oHBSrft66DaD7qRRueakcfCFKjkrK7z/juHe tAveRv3LsZTcAC+Fd/pJDLOpA3vrgEz1JX9seYNrMXTjhF5ZYeYCPejs5tTLCQLMrrDJ f8R+I7OkKnTuSQxAql5mqi67EnHQvxUE9Dk5YtbtCrodISgBSANce67CObQSh6RpUHyb sA8zKnRp/tVgpcaUJkaoyRWbBZ3FG5G77qBN5NoMDn7K2wdGzWszJvpJNM9mmRJ3JVEY Gmj8TI+ZXoXcQZQ4SjFhvZofY7mLquFTcAbykOnbfeIz0u2DyvuZDzUu388HKj2fciZq O5eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=/A0F8H+4YUeZ6ve74shsldlyLPQTpjrEfoievMlFmh0=; b=EFXdiAOc9ICVrZBh7/SBV5SZYwNsT5wFIoxUfAMCxJETVyg+zMt2eeo2UmL4bybvgO pORs5hGJ+bU+q8I6SkDR0HCtaE9pkLh13ap4dsrMlO2zevlihiuz+hVdk81HZlqKS0/n gCgk+viXjHU5Z94xe/mC0oJp/eDi2L3Br+nNt3FM6v2+VeSU7Y9cMrR2XunCmlJXh7fG JEhU/WACo7Qr9SqZfLXbk111Py+gSUUk1VneX/L9eFbTBG/1sVP8YhcYhXCySGnWi4eH OwuO8zuIh49yf0OAGYLZaaaJBVTlBuTZIMITSP/9bvQEIOvHxd0wdVjczncNTiD9+1h9 L6yA== X-Gm-Message-State: AGRZ1gJZ239wLw3fNVQ0wKO4H7dGWymxYjBfxERxL9VrLxzSMgTjHPRF hJCHz04O+ttTcXAK2cna6hcJXfRR2sWbOwZy4ltJL+wX X-Google-Smtp-Source: AJdET5ef7IkJbXSKElN5nzUNbMG0HWZr5D1werobBQqA7EbtAVucI5XQYD2SET1eunxkIZ6gjJXJa0MzbIOsLISCbDk= X-Received: by 2002:a19:4e59:: with SMTP id c86mr1609899lfb.132.1540540793376; Fri, 26 Oct 2018 00:59:53 -0700 (PDT) MIME-Version: 1.0 References: <63A34262-4216-4AFD-93B6-035CCEE44908@dana.is> In-Reply-To: From: =?UTF-8?Q?Jesper_Nyg=C3=A5rds?= Date: Fri, 26 Oct 2018 09:59:42 +0200 Message-ID: Subject: Re: Filtering array on index To: Zsh Users Content-Type: multipart/alternative; boundary="000000000000c0541805791d1aa5" --000000000000c0541805791d1aa5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable OK, one is never satisfied, as always. I have a continuation of this option parsing business. And for the record, I realize I could solve this with a loop, but it's always fun to see how far the impressive zsh functionality can take one. In addition to my filter option, I also have an override option which as it name suggests is meant to be used as an override for the filters. In other words, I want to remove the overrides from the list of filters. I'm looking for a compact expression for this. The following doesn't quite do what I want, since I can find no way of specifying that I want the "-f" prefix removed from the elements in $overrides, before its elements are then removed from the $filter list: % filters=3D(); overrides=3D() % set -- -v one -v two -f one % zparseopts -D -E v+:-=3Dfilters f+:-=3Doverrides % print -lr -- ${${filters#-v}:|overrides} one two (I wanted only "one" to be printed) The documentation for ":|" explicitly says "arrayname is the name (N.B., not contents) of an array variable", so I can't do the usual trick of nesting the operations. Is there a way to achieve this? On Fri, Oct 26, 2018 at 6:14 AM Jesper Nyg=C3=A5rds wrote: > Thank you! > > The combination of Bart's and Dana's answers gives me the perfect solutio= n > for my problem. I had skipped over the documentation for "-" as part of t= he > spec, thinking it was not relevant. > --000000000000c0541805791d1aa5--