zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Peter Stephenson <p.stephenson@samsung.com>
Cc: zsh-workers@zsh.org
Subject: Re: PATCH: trailing components
Date: Tue, 18 Jun 2019 16:45:51 +0200	[thread overview]
Message-ID: <CAHYJk3TKWjvPjSi3_p1nzs9giBuLOEAghhOB__Of1veb9+4FPg@mail.gmail.com> (raw)
In-Reply-To: <1560866087.7731.18.camel@samsung.com>

On 6/18/19, Peter Stephenson <p.stephenson@samsung.com> wrote:
> 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.

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.

-- 
Mikael Magnusson

  reply	other threads:[~2019-06-18 14:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190618130008eucas1p176cc19c1c8b831fc30b4bf7b3294f3af@eucas1p1.samsung.com>
2019-06-18 13:00 ` Peter Stephenson
2019-06-18 13:37   ` Daniel Shahaf
2019-06-18 13:54     ` Peter Stephenson
2019-06-18 14:45       ` Mikael Magnusson [this message]
2019-06-18 15:39         ` Peter Stephenson
2019-06-18 19:37       ` Daniel Shahaf
2019-06-19 15:02         ` Peter Stephenson
2019-06-20 10:14           ` Peter Stephenson
2019-06-18 14:42     ` Mikael Magnusson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHYJk3TKWjvPjSi3_p1nzs9giBuLOEAghhOB__Of1veb9+4FPg@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).