zsh-users
 help / color / mirror / code / Atom feed
* zparseopts default associative array
@ 2014-02-13  7:17 Sebastian Stark
  2014-02-13 16:56 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Stark @ 2014-02-13  7:17 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-02-15  8:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-13  7:17 zparseopts default associative array Sebastian Stark
2014-02-13 16:56 ` Bart Schaefer
2014-02-14  7:55   ` Sebastian Stark
2014-02-15  8:37     ` Bart Schaefer

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).