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

Re: PATCH: trailing components

On Tue, 2019-06-18 at 13:37 +0000, Daniel Shahaf wrote:
> Peter Stephenson wrote on Tue, 18 Jun 2019 13:01 +00:00:
> > 
> > I needed to preserve a number of trailing components of a path (other
> > than one) and couldn't think of an easy way of doing it.  Rather than
> > craft obscure pattern substitutions, or use an ad-hoc expression to
> > strip the prefix, I came up with a patch to add an optional number after
> > the "t" in history style modifiers to do this.  I put it after rather
> > than before because history-style colon expressions are quite sensitive
> > to what the first character is after the colon.
> > 
> > Before I come up with tests and fix up the ensuing failures, you can let
> > me know if there's a better way of doing this to save me the trouble.
> Here are some alternatives, but I'm not claiming any of them is better than «${foo:t2}»:

Thanks, it's useful to know other people's thinking for comparison ---
to be clear, what I was hoping for and lacking was something along the
lines of:

echo /blah/blah/blah/**/*.oogabooga(<stuff-here>)

even if <stuff-here> wasn't quite as short as :t2.  I could live with a
few more characters but a loop or complicated substitution would lead me
to propose adding the new code instead.


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