Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to overcome the (a/b/c…)(N) pattern limitation?
- X-seq: zsh-users 24797
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: How to overcome the (a/b/c…)(N) pattern limitation?
- Date: Sun, 19 Apr 2020 01:22:24 +0200
- Cc: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>, Zsh Users <zsh-users@xxxxxxx>
- In-reply-to: <CAH+w=7ZSCheyDfvUhneAG2nKcebFfCe7pSGGjjh08uGwhGNcDg@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVB3rrKq6xT58fK4m1Bs_LUkA5wMKGvM8-G_5aJaBe6xTg@mail.gmail.com> <CAN=4vMrEn-j3Y=mZcLOkPwN6Hbq-oLxJ8yXD9JwQKJadEbtmxQ@mail.gmail.com> <CAKc7PVCJfCwUUrm5KXzzehxuX1JF=Bvwkh=m7we_TiCrtw_fhQ@mail.gmail.com> <CAN=4vMp3+RqyoHi2ZUomxxMxS26KP_7fjrN5zVOeKfrhUSuecQ@mail.gmail.com> <CAKc7PVCDdMUaXYeW0yZU_Cnv=HbNR_w2tRxFcL-Ek3Zi8hvt-w@mail.gmail.com> <CAN=4vMrqRKVwsOLewSiUs_1RuqOXZQLAtHxdsDZ03hw3SoHeiA@mail.gmail.com> <CAKc7PVBegZaHrarNexZ7Gc-=G50JqaezMEY80Ay=Ru8y9E_yjA@mail.gmail.com> <CAH+w=7ZSCheyDfvUhneAG2nKcebFfCe7pSGGjjh08uGwhGNcDg@mail.gmail.com>
On Sat, 18 Apr 2020 at 22:00, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
wrote:
> On Sat, Apr 18, 2020 at 5:51 AM Sebastian Gniazdowski
> <sgniazdowski@xxxxxxxxx> 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@xxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author