Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Allow slash in alternation patterns in limited cases?
- X-seq: zsh-workers 38265
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Allow slash in alternation patterns in limited cases?
- Date: Sun, 10 Apr 2016 22:36:53 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to; bh=6dvfW5ztZ8PotG1TdngWerF+SKjizQ1b+Yp6cYNki68=; b=GFUrYW33/ksWsKiofmjotlUCwpP03PrL0DYvECIrcPrGDnTYG5ercSl+xBEQsyZil0 GsWK4i7xvDV80Ol0hXfhUUFpR1HGJg2i7eL/QyUwAvuTjExmOUIzMKl/EJtxigdLQo+k +76eA0Xe6OseESseFZimYy4Jn5SUR3mv+wPrZzBsZi9mql48NI5EhQ0elJFqDAh4bxyn IhNWDjX3MbRU5QXM2LFezH0hVmMukm1qc5lybPMVyMum7++Gn+jbBeLGkMgrf4GRlwOo U6uppLzvUhq4+ms5fIE5uMGa5o+I8K4dTtFod+m1vuUV9gzOCkp+9RMagMhCTDatKMoK OmQw==
- 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
You can't do (/foo/bar|/baz)/bong, but would it be possible to allow
it when each alternatee is a full pattern and there's nothing outside
the alternation? To put it another way:
/path/(to/file|or/another/file) # nope, too hard
(/path/to/a/dir/*|/path/to/some/other/files/*) # can we allow this?
The reason one might want this is for example doing things like
echo ($file1|file2)(om[1]) #where $file1 and $file2 are full paths to
files in different directories
echo (${(~j:|:)fpath}/_stat)(om)
etc
I imagine this is at least a little bit more possible than the general
case? The scanner() function is scary, but since I think some of you
have looked at it recently, is your gut feeling that it's doable? If
so, I'll have a try.
If not, would it be possible to invent some new syntax to "paste" two
or more globs together so that a single set of glob
quals/sorts/flags/subscripts could apply to it?
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author