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

Re: Implement a key-value deserialization or something similar



Example Zsh solution could be: afunc ...normal parameters...
"MYDATA:1:OTHERDATA:2:" and then: local
mydata="${7/(#b)*MYDATA:([^:]#):*/$match[1]}". I could write a
function to hide the somewhat complex pattern code, it would work like
this: get_key "$7" "MYDATA"; local mydata=$REPLY. That solution works
but I really want to research this and find solution that's best or
useful in a specific way. Any thoughts?

Best regards,
Sebastian Gniazdowski

On 5 September 2016 at 23:25, Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
> PS. To put it other way, it's that I need to pass a bunch of simple
> marks on some data to a function and don't need reserved positional
> parameters for them, especially because some of the marks are
> optional.
>
> Best regards,
> Sebastian Gniazdowski
>
>
> On 5 September 2016 at 22:47, Sebastian Gniazdowski
> <sgniazdowski@xxxxxxxxx> wrote:
>> Hello,
>> I'm wondering how to best implement a parameter $x, say $7 – I mean a
>> last parameter to a parameter-rich function – that would serve as "put
>> various key-data things here to stop adding more parameters"? Possible
>> call could be: afunction param1 param2 ... "MYDATA=1 OTHERDATA=true"
>>
>> Best regards,
>> Sebastian Gniazdowski



Messages sorted by: Reverse Date, Date, Thread, Author