std.getopt suggestion

Jens Mueller jens.k.mueller at gmx.de
Wed Oct 5 06:26:47 PDT 2011


Christophe wrote:
> Andrei Alexandrescu , dans le message (digitalmars.D:146070), a écrit :
> > On 10/4/11 2:39 PM, Andrei Alexandrescu wrote:
> >> On 10/4/11 12:05 PM, Christophe wrote:
> >>> Andrej Mitrovic , dans le message (digitalmars.D:146060), a écrit :
> >>>> I'm don't often use getopt just for the fact that I can't use
> >>>> single-dash arguments like '-release'. DMD uses this syntax, and so to
> >>>> other tools. It's not a big deal thanks to D's fantastic
> >>>> string-manipulation abilities, so I just roll my own. All I need is a
> >>>> switch(args) statement.
> >>>
> >>> I don't use getopt often either. That does not prevent me to wish getopt
> >>> could become adequate to my needs...
> >>
> >> It already is because your needs are the empty set.
> >>
> >> Andrei
> > 
> > On second thought what you said suggests your needs set may be nonempty, 
> > but said needs are not fulfilled by the current std.getopt.
> > 
> > What exactly in std.getopt does not fulfill your needs? Would assembling 
> > the three variables into a structure help?
> 
> 
> No, it wouldn't.
> 
> The main reason why I don't want to use getopt is because the syntax "-o 
> output" (short-option, space, argument), and that is the main thing 
> I want to do. I think I posted about this in the thread.

This will be supported with my changes. I hope I can act soon on the
feedback and clean up the pull request.

> Enabling single-dash long option would be nice too.

I suppose there is no technical to not support this kind of option.
Though it does make configuring getopt more difficult and I don't see
enough usage to add it. Why is this important to you? I see little
benefit of -pedantic over --pedantic. If you believe this option is very
important (because you want to save a single character), then you could
provide the short alias -p.
Is this just a matter of taste?
Please convince me.

Jens


More information about the Digitalmars-d mailing list