zsh-users
 help / color / mirror / code / Atom feed
* Optimal use of zparseopts
@ 2005-04-15  1:46 Mariusz Gniazdowski
  2005-04-15  3:11 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Mariusz Gniazdowski @ 2005-04-15  1:46 UTC (permalink / raw)
  To: zsh-users

Hi.
I'm trying to use zparseopts but it can be done in many ways.
Which is the most optimal? I mean:

- zparseopts can put options into arrays, like ( -l -h -t )

	How to best test if some value is in array?


- It can put values into arrays too

	How to reach it? Find key, then take [keyidx+1] ?


- It can put values into associative arrays

	How to test if option without argument has ben given? Something
	like:
		isset($hash[-h])

	I tried to use -K option, but it's like not working:

fun() { 
	typeset -A Args
	Args=(-sl 0 -si 0 -sm 0 -ss x)
	echo ${(kvqq)Args}
	zparseopts -K -D -E -A Args sl si sm ss sd
	echo ${(kvqq)Args}
}
$ fun -si a 
'-si' '0' '-sl' '0' '-sm' '0' '-ss' 'x' 
'-si' ''	


- How to handle the same option given many times?

	Like:
		fun -s abab -s ab -s x

-- 
Mariusz Gniazdowski

--------------------------------------------------------------------
Nie dzwon do Londynu...
zanim nie sprawdzisz HALO.interia.pl
Tutaj: http://link.interia.pl/f1870


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

end of thread, other threads:[~2005-04-15  7:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-15  1:46 Optimal use of zparseopts Mariusz Gniazdowski
2005-04-15  3:11 ` Bart Schaefer
2005-04-15  7:39   ` Mariusz Gniazdowski

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