Subject: zparseopts varieties
From: Sebastian Gniazdowski <[email-masked]>
To: Zsh hackers list <[email-masked]>
Date: Tue, 26 Jan 2016 09:53:04 +0100
List-Id: Zsh Workers List <zsh-workers.zsh.org>

Hello
Argument of -M will not be put into Mopt associative array:

% typeset -A Mopt; set -- -M arg; zparseopts -D -A Mopt "M::"; echo
${(kv)Mopt}; echo "1: $1, 2: $2"
-M
1: arg, 2:

however, when setting "-Marg" instead of "-M arg":

% typeset -A Mopt; set -- -Marg; zparseopts -D -A Mopt "M::"; echo
${(kv)Mopt}; echo "1: $1, 2: $2"
-M arg
1: , 2:

and, when making argument mandatory (with single colon in "M:"):

% typeset -A Mopt; set -- -M arg; zparseopts -D -A Mopt "M:"; echo
${(kv)Mopt}; echo "1: $1, 2: $2"
-M arg
1: , 2:

Also, double colon (optionality of argument) cannot take array name:

typeset -A Mopt; set -- -M arg; zparseopts -D "M::=Mopt"; echo
${(kv)Mopt}; echo "1: $1, 2: $2"
zsh: bad set of key/value pairs for associative array

Best regards,
Sebastian Gniazdowski