zsh-users
 help / color / mirror / code / Atom feed
* Replacing getopts with zparseopts
@ 2011-05-15 14:34 Thorsten Kampe
  2011-05-15 18:00 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Kampe @ 2011-05-15 14:34 UTC (permalink / raw)
  To: zsh-users

Hi,

"From Bash to Z Shell" mentions that one could possibly use zparseopts 
instead of getopts - for instance to get long GNU style options ("--
long-option"). Unfortunately neither the book nor the man page were too 
helpful (my fault) in "translating" the standard option case.

Could someone help me to create the below simple construct with 
zparseopts and making sure that "-d" and "--debug", "-h" and "--help", 
and "-v" and "--verbose" refer to the same option?!

##
while getopts dhv opt
    do case $opt in
           (d)  setopt xtrace;;

           (h)  print_help
                exit;;

           (v)  print_version
                exit;;

           (\?) print_usage >&2
                exit 1;;
       esac
done
##

Thanks in advance,
Thorsten


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

end of thread, other threads:[~2011-05-16 18:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-15 14:34 Replacing getopts with zparseopts Thorsten Kampe
2011-05-15 18:00 ` Bart Schaefer
2011-05-15 18:49   ` Thorsten Kampe
2011-05-16 18:44     ` 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).