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

Re: [PATCH] Support the mksh's ${|func;} substitution



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