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

zparseopts varieties



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



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