zsh-users
 help / color / mirror / Atom feed
* strange behaviour of zparseopts
@ 2021-05-07 10:30 Roger Mason
  2021-05-07 11:05 ` Daniel Shahaf
  2021-05-07 11:05 ` Mikael Magnusson
  0 siblings, 2 replies; 4+ messages in thread
From: Roger Mason @ 2021-05-07 10:30 UTC (permalink / raw)
  To: zsh-users

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.

Roger


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

* Re: strange behaviour of zparseopts
  2021-05-07 10:30 strange behaviour of zparseopts Roger Mason
@ 2021-05-07 11:05 ` Daniel Shahaf
  2021-05-07 17:26   ` Roger Mason
  2021-05-07 11:05 ` Mikael Magnusson
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2021-05-07 11:05 UTC (permalink / raw)
  To: Roger Mason, zsh-users

Roger Mason wrote on Fri, 07 May 2021 10:30 +00:00:
> zparseopts -D -E -A elkopts -actype:

The «-actype» is interpreted as the «-a» option to zparseopts.  Add a «-» end-of-options guard before it.


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

* Re: strange behaviour of zparseopts
  2021-05-07 10:30 strange behaviour of zparseopts Roger Mason
  2021-05-07 11:05 ` Daniel Shahaf
@ 2021-05-07 11:05 ` Mikael Magnusson
  1 sibling, 0 replies; 4+ messages in thread
From: Mikael Magnusson @ 2021-05-07 11:05 UTC (permalink / raw)
  To: Roger Mason; +Cc: zsh-users

On 5/7/21, Roger Mason <rmason@mun.ca> 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


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

* Re: strange behaviour of zparseopts
  2021-05-07 11:05 ` Daniel Shahaf
@ 2021-05-07 17:26   ` Roger Mason
  0 siblings, 0 replies; 4+ messages in thread
From: Roger Mason @ 2021-05-07 17:26 UTC (permalink / raw)
  To: zsh-users


Daniel Shahaf writes:

> The «-actype» is interpreted as the «-a» option to zparseopts.  Add a «-» end-of-options guard before it.

Mikael Magnusson writes:

>I'm reasonably sure you just want

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

Thank you both, that was indeed the problem.  My sanity is restored.

Roger


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

end of thread, other threads:[~2021-05-08 18:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07 10:30 strange behaviour of zparseopts Roger Mason
2021-05-07 11:05 ` Daniel Shahaf
2021-05-07 17:26   ` Roger Mason
2021-05-07 11:05 ` Mikael Magnusson

zsh-users

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/zsh-users

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 zsh-users zsh-users/ http://inbox.vuxu.org/zsh-users \
		zsh-users@zsh.org
	public-inbox-index zsh-users

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.users


code repositories for the project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git