From: Sebastian Stark <seb.stark@gmail.com>
To: zsh-users@zsh.org
Subject: zparseopts default associative array
Date: Thu, 13 Feb 2014 08:17:58 +0100 [thread overview]
Message-ID: <CABABwVH+Yu-oFiE8OYkmNHxRGSwfYT8331oA0=0s9quom3CTGA@mail.gmail.com> (raw)
Hi,
if I have this script:
typeset -A o
o=(-a AAA -b BBB)
zparseopts -K -A o a: b:
print -- ${(kv)o[@]}
and run it such:
./script.sh -a foo
I would expect it to output "-a foo -b BBB". But the output is "-a
foo". In the manual the -K option to zparseopts is described as this:
" -K With this option, the arrays specified with the -a and -A
options and with the `=array' forms are kept unchanged when none of
the specs for them is used. This allows assignment of default
values to them before calling zparseopts."
Maybe I misunderstood something, but isn't my example the intended use
of -K? Or is the condition "when none of the specs for them is used"
really meant like "if one option is given, all other default values
are emptied"? How would this make sense?
I tried with zsh versions 5.0.2 and 4.3.10.
Sebastian
next reply other threads:[~2014-02-13 7:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-13 7:17 Sebastian Stark [this message]
2014-02-13 16:56 ` Bart Schaefer
2014-02-14 7:55 ` Sebastian Stark
2014-02-15 8:37 ` 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='CABABwVH+Yu-oFiE8OYkmNHxRGSwfYT8331oA0=0s9quom3CTGA@mail.gmail.com' \
--to=seb.stark@gmail.com \
--cc=zsh-users@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).