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

Re: zparseopts and longopts



On Fri, May 13, 2016 at 04:25:28AM -0700, Bart Schaefer wrote:
> On Thu, May 12, 2016 at 4:16 AM, Atte Peltomaki <atte.peltomaki@xxxxxx> wrote:
> > Executing with imaginary new option:
> >
> > % ./test.zsh --gnu argh --gnu-tard rms --gnu-tard-added-even-longer-opt whyohwhy
> > --gnu argh
> > --gnu-tard -added-even-longer-opt
> 
> Well, you've told zparseopts that --gnu-tard is an option that takes a
> mandatory argument, and you have not told zparseopts that
> --gnu-tard-add... is an option, and the argument of an option is
> allowed to appear in the same word as the option itself (so that -a2
> is the same as -a 2), so zparseopts believes -add... is the argument
> of the option you told it about.

Makes sense, but also makes it impossible to use zparseopts with a
caller that may spontaneously add options and expect scripts to work
unmodified.

-- 
Atte Peltomäki
     atte.peltomaki@xxxxxx <> http://kameli.org
"Your effort to remain what you are is what limits you"



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