Re: [PATCH 07/25] parse-options: make some arguments optional, add callbacks.
- From
Nicolas Pitre <nico@cam.org>
- Date
- Oct 16, 2007, 17:21 UTC
- Message-ID
- <alpine.LFD.0.9999.0710161320400.19446@xanadu.home>
- In-Reply-To
- <20071016165319.GC13946@artemis.corp>
On Tue, 16 Oct 2007, Pierre Habouzit wrote:
Show 30 quoted lines
> On Tue, Oct 16, 2007 at 04:44:44PM +0000, Johannes Schindelin wrote:
> > Hi,
> >
> > On Tue, 16 Oct 2007, Ren? Scharfe wrote:
> >
> > > Pierre Habouzit schrieb:
> > > > This bit is to allow to aggregate options with arguments together when
> > > > the argument is numeric.
> > > >
> > > > +#if 0
> > > > + /* can be used to understand -A1B1 like -A1 -B1 */
> > > > + if (flag & OPT_SHORT && opt->opt && isdigit(*opt->opt)) {
> > > > + *(int *)opt->value = strtol(opt->opt, (char **)&opt->opt, 10);
> > > > + return 0;
> > > > + }
> > > > +#endif
> > >
> > > I don't like it, it complicates number options with unit suffixes (e.g.
> > > --windows-memory of git-pack-objects).
> >
> > Why? It only means that you cannot say -W10mxabc instead of -W10m xabc.
> >
> > Remember: this is a special case for OPT_INTEGER. Nothing to do with
> > OPT_SIZE, which you'd probably implement as a callback.
>
> Yeah but the point is that you can't migrate an option currently being
> an integer to an OPT_SIZE because of that (see my other mail). Meaning
> that once an argument is of type OPT_INTEGER you can't change it's type
> in the future _AT ALL_ without breaking backward compatibility badly.
> I'd say it's a rather sucky design.And what's the point of supporting so criptic arguments? It doesn't have to go that far.
Nicolas