zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: zparseopts varieties
Date: Tue, 26 Jan 2016 09:53:04 +0100	[thread overview]
Message-ID: <CAKc7PVCxCs7hfAvG=ZG1v=6Ez=yX-wQHnjyeuN17V-Ky+rdAvw@mail.gmail.com> (raw)

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


             reply	other threads:[~2016-01-26  8:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-26  8:53 Sebastian Gniazdowski [this message]
2016-01-27  3:00 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKc7PVCxCs7hfAvG=ZG1v=6Ez=yX-wQHnjyeuN17V-Ky+rdAvw@mail.gmail.com' \
    --to=sgniazdowski@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).