Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Implement a key-value deserialization or something similar
- X-seq: zsh-users 21839
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- Subject: Re: Implement a key-value deserialization or something similar
- Date: Tue, 6 Sep 2016 00:20:16 +0000
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=ktRvN+TX7Xb+AuIx uj1K0JR2sJI=; b=zTKWzjj7pi9hCcKxbd6GC1BhWotKEHFU0DWN7LtWIPbD7LlY vivj8jDVM27E5GvyWhMJyIQqpXrW9lxCM5dKLSGm5l4Kq+E/gwirOF+51vU3YSai rgsKh3ewvvUYNbsla7ymjKo0DlECnPhQie7VhVAe3XxvPdr8Tnz6UcK50oA=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=ktRvN+TX7Xb+AuI xuj1K0JR2sJI=; b=Ssq+4RepA45tBvPNPvPo1orHMjsu8FR20b+ng+KQhxFX+LO ED7HaZ8lvdmz3/3bxYCcYDTWee7vOIwmWgkD1u+iSGy2N0eyZyNX4u5AXg5tZmGG 4PFDffpymPx0jiExQewBIvKQLESjumlPAMDSyIdvHt022/L9Rz9hx8s2f5oo=
- In-reply-to: <CAKc7PVB19jOGwcsu5bL2zGuEioJXM9LuT009WDzZdg2eNobmQA__43171.2364581928$1473108546$gmane$org@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>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVB19jOGwcsu5bL2zGuEioJXM9LuT009WDzZdg2eNobmQA__43171.2364581928$1473108546$gmane$org@mail.gmail.com>
Sebastian Gniazdowski wrote on Mon, Sep 05, 2016 at 22:47:11 +0200:
> 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"
Like this:
% local -A reply=(mydata 1 otherdata true)
% () { echo ${${(P)7}[otherdata]} } {1..6} reply
true
Or you could adopt the Perl convention:
() {
local -A args=( "$argv[@]" )
} mydata 1 otherdata true
Messages sorted by:
Reverse Date,
Date,
Thread,
Author