Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Re: (Y) modifier: up to N matches?
- X-seq: zsh-workers 32695
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- Subject: Re: [PATCH] Re: (Y) modifier: up to N matches?
- Date: Wed, 4 Jun 2014 08:01:21 +0200
- Cc: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, zsh workers <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=EPxqZ7Dq1gSQaxG/OUFEbCPCdlVZty7P88KmpNMu3fQ=; b=rfN7D4K90KmcVIZjNjhOPOqsmof2VArJt9gL6/8JnW3ZAHCk42VWf6diXWNz1yr6xK v4RmLz8KgwrJqolPShSAhbTC/gLKSOR2XCLFcywffm5krEUCxkxnGn+3rAmRIw8+qF2y KiD6/G1orwY4Sp431aHsyPzEV9gPOjxSwZ7pPF+FTkFKhjdnKdrn33gIcsGuWk4B00hX bSFQ45Ej9HMUhcWJ05tOj+vV19SdTWuRNhvSspLzDhGuwd3wB15QofMb2SfjeZRhtdsZ pXfSxSiHK/x8ikztiWQ4iFZCVKByPJs2Nsz+FSVXNypicBO2WbRT/RXnmQJJmOoPCxOt nW0g==
- In-reply-to: <20140604020804.GA2032@tarsus.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20140602182346.GB1858@tarsus.local2> <140602204603.ZM26905@torch.brasslantern.com> <20140604020804.GA2032@tarsus.local2>
On 4 June 2014 04:08, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> Bart Schaefer wrote on Mon, Jun 02, 2014 at 20:46:03 -0700:
>> On Jun 2, 6:23pm, Daniel Shahaf wrote:
>> }
>> } Would it make sense to have (Y) take a numeric argument specifying the
>> } maximal number of files to match? e.g., *(NY5) would expand to between
>> } 0 and 5 filenames (but never more than 5).
>>
>> My concern is that people are going to expect the (o)/(O) qualifiers to
>> take effect before (Y) does, and will be confused about the "skipped"
>> files when it takes effect after. If (Y) can't return more than one
>> result, there's nothing to sort.
>
> The expectations about sorting are just as much of a problem with (Y) as
> they would be with (Y42): in both cases there might be "skipped" files.
> For example, in the source dir, *(Y/on) [or *(Y1/on)] might result in "Etc"
> even though "Doc" exists.
>
> Let's clarify that in the documentation of (Y).
>
>> However, I can't come up with any other objection.
>
> Two patches attached. The first patch implements (Y42) and adds completion
> and the above-mentioned docs clarification. (The two latter parts should be
> useful even if we don't add an argument to (Y).) The second patch isn't
> strictly required, but it cleans up the return type changes that are no
> longer needed after the first patch.
>
> FWIW, I'm intentionally making (Y) without argument an error; we can settle
> on its semantics later after (Y42) has seen some "in the field" use. The
> spelling (Y1) can be used instead.
>
> Cheers,
>
> Daniel
We already have [1,42] for the first 42 matches after sorting, just
make a reference to that I guess? And as for taking arguments, all
other glob qualifiers that take variable length arguments do it in the
form of u:args: where the : can be any character, so this should be
consistent with that, I think.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author