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 32725
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- Subject: Re: [PATCH] Re: (Y) modifier: up to N matches?
- Date: Fri, 6 Jun 2014 02:45:19 +0000
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:in-reply-to; s=mesmtp; bh= zhFvVm5dIK7WLBFr5BM6bAEmmLs=; b=pCQ+xxlLDnichVn9u0jTb2PW2FwlQ7ii Y4Y9Ndo1rlPnp3XX/OWdLtWxqh0ku09+Y5352k2/m/sR/3UQzgZl1Aoa91kxhJJv 95XLHICuAw8/UrXoIYRjd/3kXw5AYSRN5wzBq6eu3dYmVzCrYioJA1ds8Fpvty/a /WTaps8s02c=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:in-reply-to; s=smtpout; bh=zhFvVm5dIK7WLBFr5BM6bAEmmLs=; b=uqsxYOEYu0woM9fF1QXue7HBprwF W6Jsj2G2rCFX86+P3JvicfDjBLN7ItFCG4eSmTkTm3Q2Regm+iT6IiHTudXd2QjU 53LYasPnm2EyLQsi52u8/FZPQlh8sueLJF3RMFUMrLGsbjpM9dRDaJL0BB9y/R+u PjXxMkDigXQPx98=
- In-reply-to: <25969.1402010685@thecus.kiddle.eu>
- 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> <140603234229.ZM29030@torch.brasslantern.com> <20140604230835.GD1970@tarsus.local2> <CAH+w=7YJ0Y8qO3j_z4e_7cHQ857GyFOr6PXqAdvBEgUj=uhV6Q@mail.gmail.com> <25969.1402010685@thecus.kiddle.eu>
Oliver Kiddle wrote on Fri, Jun 06, 2014 at 01:24:45 +0200:
> Considering uses of the new (Y) modifier as I've understood it: I
> commonly use (../)# to find the top-level of something. For example
> (../)#.git(:h) will find the top of a git checkout. It'd be useful if
> this would stop searching after the first match which should be the
> one that involves going up as few directories as possible.
It does:
% setopt extendedglob
% cd $(mktemp -d)
% mkdir -p foo A/foo A/B
% cd A/B
% echo (../)#foo(:A:h:t)
A tmp.Ykz8jNBvJo
% echo (../)#foo(Y1:A:h:t)
A
(Also: 'git rev-parse --show-toplevel')
> I'm also inclined to think that with downward globs that you'd want it
> to find the nearest match so checking files before directories.
That's the current behaviour:
% mkdir -p A/B/foo A/foo
% echo **/foo(Y1)
A/foo
It may be worthwhile adding a unit test for this to Test/D02glob to
ensure this behaviour doesn't change.
Daniel
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author