Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: strange behaviour of zparseopts



On 5/7/21, Roger Mason <rmason@xxxxxx> wrote:
> Hello,
>
> The following minimal example illustrates the problem I am having.
>
> drat.sh
> ----------------------------------------------------------------------------------------------------------
> #!/usr/local/bin/zsh -f
>
> zparseopts -D -E -A elkopts -tasks:  -maxthd: -scale: -xc: -mix: -scl:
> -spsource: -kx: -ky: -kz: -write:  \
> 	   -quality:
>
>
> zparseopts -D -E -A elkopts -actype:
>
> ----------------------------------------------------------------------------------------------------------
>
> The first invocation of zparseopts works (no error is returned).  The
> second returns:
>
> ./drat.sh:zparseopts:7: missing option descriptions
>
> Swapping the order of the invocations has no effect (beyond changing the
> line number at which the error arises).
>
> I'm running zsh-5.8 on freebsd-11.4.
>
> Thanks for any help offered.

I'm reasonably sure you just want

zparseopts -D -E -A elkopts - -actype:

otherwise the -a is taken as an option for zparseopts:
-a  -- specify array in which to store parsed options

It is the only lowercase option for zparseopts and unknown options
seem to serve the same purpose of terminating the option list and
starting the argument list which is why the first command works.

-- 
Mikael Magnusson




Messages sorted by: Reverse Date, Date, Thread, Author