Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Filtering array on index
- X-seq: zsh-users 23723
- From: dana <dana@xxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Filtering array on index
- Date: Thu, 25 Oct 2018 15:42:06 -0500
- Cc: Jesper Nygårds <jesper.nygards@xxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- 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==
- In-reply-to: <CAH+w=7ZtqnxZqvYrP0AqNRj5iLAND-YrMo3-ZN9Vzk_Ax4vKNA@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CABZhJg80vQuMHGKABkzR1bdtt89Akpkfd8kWOV83N-qvqioaXw@mail.gmail.com> <CAH+w=7ZtqnxZqvYrP0AqNRj5iLAND-YrMo3-ZN9Vzk_Ax4vKNA@mail.gmail.com>
On 25 Oct 2018, at 15:21, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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 ‘:-’ 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author