Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: trailing components



On Tue, 2019-06-18 at 16:45 +0200, Mikael Magnusson wrote:
> The only complaint I could imagine here (but I'm not making it) is
> that this breaks
> echo $foo:t42
> to echo the last path segment followed by the string 42
> Would it be possible to limit the new syntax to *(:t42) and ${foo:t42}
> where previously the 34 is invalid (or at least silently ignored)? If
> it is I think it would be nice to do so, but I'm not going to object
> if it goes in as is. It's certainly nicer than the expressions
> suggested earlier in the thread.

That's straightforward.  The same problem applies to !-history, but (i)
what you see is what you get in that case (ii) that's exactly the place
where brevity is particularly valuable, so maybe I can just document
that as a small incompatibility.

Looks like it's worth going ahead.  I would think doing the same for :h
makes sense, if only for consistency:  it would be a bit odd to have one
and not the other.  I'll make them both mean the number of components to
leave, even though the default behaviour is different, with head taking
off one path and tail leaving one path.  I think the way repeated head
works means that / is one and /foo is two components.

pws




Messages sorted by: Reverse Date, Date, Thread, Author