Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Allow slash in alternation patterns in limited cases?
On Mon, Apr 11, 2016 at 12:29 PM, Peter Stephenson
<p.stephenson@xxxxxxxxxxx> wrote:
> On Mon, 11 Apr 2016 12:22:49 +0200
> Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>> > But this is
>> > going to be inconsistent with pattern matching one way or another. So a
>> > different syntax would be more sensible.
>>
>> Doesn't this already work as is with pattern matching? Eg, I could do
>> /path/to/**/*~^(/path/to/a/dir/*|/path/to/some/other/files/*)
>> even though that would be insanely inefficient, especially when
>> /path/to is just /.
>
> "~" is already handled specially: we pass in a flag to say we're at top
> level so just keep going if you find a "/" after a "~". This is much
> easier as once we've seen the ~ we can relax --- no more handling of
> individual directories is needed as we're going to apply the exclusion
> in one go at the end (hence the suggestion of the new option to prune
> directories). This has always been the documented way in this case.
Maybe I misunderstood your original point. I thought you meant making
(foo/bar|baz/bong) work in a glob would make it more incompatible with
pattern matching, but it already works there. So as far as I can see
if the change was possible, it would bring the two closer together,
not further apart. I only used the ~ example to mean that the part
after the ~ is a pattern match, not a glob, and uses the exact pattern
I wanted in the glob with the same results.
I guess the takeaway from the thread is that it's mostly not possible.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author