Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Support the mksh's ${|func;} substitution
- X-seq: zsh-workers 44735
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH] Support the mksh's ${|func;} substitution
- Date: Sat, 7 Sep 2019 01:16:00 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=ZXd0+BIGWjXGhnlaINK7btfZ0hyAqzF0PphyaG2J76E=; b=AzDB84rR3LRuCsJmfaBdMm798xtjqWYBkvNKAYsjELOsY0K3yuUIZhRuDLo/wtGwMh hpy/kvELwQfQK+KSggFElxI5C3mCwIqIGqCL2x4Ehw1a3un3X1ZQyHjQMfaGT4LulbBs YBxCYJmgL+TB4vWCNMoHwV4HzZHdhD4OGhHIfEz4KGXTAMehRxdUS18rpZRnGWhb4Q2Q d1W6HYr7suJxh5NK0WUUg4MZSjo0/lGgysWY36cxuFdt5IJiEGPkQ5xyObN0NVxlbKai gDT3v//MqRQ2m1oOyr5wipjOpvwXgS/I+DRw7/z4HmN2HgLNq/Nux2YGH2Pt/yZqGNA6 OJkA==
- In-reply-to: <CAKc7PVBTw2j=awaf0wAkyyO08k=vossU28fvZ=s+fhqMkcKuJQ@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVBTw2j=awaf0wAkyyO08k=vossU28fvZ=s+fhqMkcKuJQ@mail.gmail.com>
I see no response. Is it because the substitution isn't zsh-like, ie. flag
based? I can prepare such patch, ie. assign a flag and integrate it nicely
into the zsh substitution stack.
pt., 6 wrz 2019, 02:52 użytkownik Sebastian Gniazdowski <
sgniazdowski@xxxxxxxxx> napisał:
> Hello
> Some notes on the patch:
> - the subst is being handled at top of paramsubst, because it's made
> uncompatible with (...)-flags (${|(U)funct;} looks awful, more on this
> in the patch),
> - then the `s' variable is advanced past the semicolon, so that the
> rest of the function can safely progress doing (almost) nothing
> - one thing that the function still does is a fetchvalue, which I
> prevent from setting vunset to 1 in case of ${|func;}
>
> If commited, the substitution will be super useful in // substitution.
> E.g.:
>
> arr=( val1 val2 abc1 abc3 )
> func() { REPLY="${(C)match[1]}"; }
> print -rl ${arr[@]//(#b)(*)/${|func;}}
>
> Output:
> Val1
> Val2
> Abc1
> Abc3
>
> PS. I did install mksh and test the substitution, it works the same.
> --
> Sebastian Gniazdowski
> News: https://twitter.com/ZdharmaI
> IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
> Blog: http://zdharma.org
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author