Article 54NDW [SOLVED] zparseopts - How to pass multiple argument to an option

[SOLVED] zparseopts - How to pass multiple argument to an option

by
blueray
from LinuxQuestions.org on (#54NDW)
I am using zsh 5.4.2. The function that is causing issue is:

Code:function zp () {
zparseopts -E -watch:=o_watch -show=o_show
echo "show : $o_show"
echo "watch : $o_watch"
}Output:

Code:$ zp --show --watch "Watching"
show : --show
watch : --watch Watching

$ zp --watch --show
show :
watch : --watch --showYou can see that, If I do not pass a value to --watch (which's argument is mandatory) then it takes the next option in this case --show as the argument. It should actually show an error like zp:zparseopts:1: missing argument for option: -watch

Why is --watch taking --show as an argument instead of throwing an error.latest?d=yIl2AUoC8zA latest?i=AUxZLHrDHkU:SgwY6SyKpBk:F7zBnMy latest?i=AUxZLHrDHkU:SgwY6SyKpBk:V_sGLiP latest?d=qj6IDK7rITs latest?i=AUxZLHrDHkU:SgwY6SyKpBk:gIN9vFwAUxZLHrDHkU
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments