zsh-users
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Roman Perepelitsa <roman.perepelitsa@gmail.com>,
	Zsh Users <zsh-users@zsh.org>
Subject: Re: How to overcome the (a/b/c…)(N) pattern limitation?
Date: Sun, 19 Apr 2020 01:22:24 +0200	[thread overview]
Message-ID: <CAKc7PVDZQgh7NA2riRH9+Hm0gYm52YGNbLsy_SmtkA2o7pcLVA@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7ZSCheyDfvUhneAG2nKcebFfCe7pSGGjjh08uGwhGNcDg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2541 bytes --]

On Sat, 18 Apr 2020 at 22:00, Bart Schaefer <schaefer@brasslantern.com>
wrote:

> On Sat, Apr 18, 2020 at 5:51 AM Sebastian Gniazdowski
> <sgniazdowski@gmail.com> wrote:
> >
> > I was trying to do: ls (/tmp/somedir/gh|./gh)(N) to obtain the error
> > message:
> >
> > zsh: bad pattern: (/tmp/somedir/gh|./gh)(N)
>
> Just making sure you don't mean that you were trying to obtain the
> error message?  If you did mean that, what did you get instead?
>

No, I didn't want to obtain the error, so I guess that your first
impression was correct.


> On Sat, Apr 18, 2020 at 7:43 AM Sebastian Gniazdowski
> <sgniazdowski@gmail.com> wrote:
> >
> > Yes, but as I wrote, such patterns are useful, good ones and I'm looking
> > for an alternative form for them.
>
> In this case, "useful" collides directly with "practical" given the
> semantics of "/" imposed by the underlying file system.
>

What do you mean? In the big, complete picture the user installs a
binary-release, GitHub plugin. It can come either from a deb/rpm file or
from a tar.gz. If it comes from deb (selected when the system has
dpkg-deb), then the binary will be located in plugin-dir/usr/bin/gh, if
from tarball then in plugin-dir/gh. So to match the file with the pick
ice-mod – Zinit's (formerly Zplugin) tool to select the binary that should
be added to PATH – an alternative (usr/bin/gh|gh) comes to mind. The issue
has resolved by using **/gh, however it puzzled me that such /-using
patterns aren't allowed. Mikachu has a patch allowing them, maybe it's
worth adding it to the upstream?:

http://comm.it.cx/cgit/zsh-cvs/commit/?h=mika&id=512bd3f23ea8b4170d88582521d417cdb247413a


> > list=( ${(M)~ZINIT_ICE[pick]##/*}(DN)
> > $local_dir/$dirname/${~ZINIT_ICE[pick]##/*}(DN.) )
>
> I'm a little puzzled about what the contents of ZINIT_ICE[pick] look
> like.  Do you not want this to work for (.gh|/tmp/gh) as well as the
> reverse?
>

It can be either an absolute path, like "$ZPFX/bin/something" (where ZPFX
is ~/.zinit/polaris by default) or an pattern that'll be applied inside the
plugin directory.

If it's a simple list of alternatives without nested parens, you
> should be able to do this:
>
> list=(
> ${^~${(s:|:)ZINIT_ICE[pick]}//(#b)(#s)([^\/]*)/$local_dir\/$dirname\/$match(#q.)}(DN)
> )
>

Thanks, I'll think about extending pick''.
-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zinit
Blog: http://zdharma.org

  reply	other threads:[~2020-04-18 23:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-18 12:49 Sebastian Gniazdowski
2020-04-18 12:55 ` Roman Perepelitsa
2020-04-18 13:41   ` Sebastian Gniazdowski
2020-04-18 13:45     ` Roman Perepelitsa
2020-04-18 14:07       ` Sebastian Gniazdowski
2020-04-18 14:07         ` Sebastian Gniazdowski
2020-04-18 14:31         ` Roman Perepelitsa
2020-04-18 14:41           ` Sebastian Gniazdowski
2020-04-18 20:00             ` Bart Schaefer
2020-04-18 23:22               ` Sebastian Gniazdowski [this message]
2020-04-19  0:02                 ` Bart Schaefer
     [not found]   ` <CAKc7PVCJfCwUUrm5KXzzehxuX1JF=Bvwkh=m7we_TiCrtw_fhQ__30396.4317821496$1587217473$gmane$org@mail.gmail.com>
2020-04-19  6:44     ` Stephane Chazelas

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=CAKc7PVDZQgh7NA2riRH9+Hm0gYm52YGNbLsy_SmtkA2o7pcLVA@mail.gmail.com \
    --to=sgniazdowski@gmail.com \
    --cc=roman.perepelitsa@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-users@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).