GetOpt formatting improvements

Isaac Dupree isaacdupree at charter.net
Sun Jun 29 19:40:59 EDT 2008


Duncan Coutts wrote:
> Actually we go one step further and leave off the args on the short
> options since they're shown on the long options anyway. I'm not sure
> everyone wants that so I'm not really proposing it. This is what it
> looks like:
> 
>   -f FLAGS  --flags=FLAGS                   Force values for the given...
> vs
>  -f --flags=FLAGS                  Force values for the given flags in...

okay..

> Similarly:
> 
>   -v[n]     --verbose[=n]                   Control verbosity (n is 0--3,...
> vs
>  -v --verbose[=n]                  Control verbosity (n is 0--3, default...

This confuses me... perhaps because the argument is optional, I don't as 
easily understand that it's allowed on the short form.  What about 
short-form spacing?  is "-v 2" allowed, or only "-v2"?  Is this 
contradictory to the above example where "-f FLAGS" is expected (though 
probably "-fFLAGS" works too)?

maybe these can be resolved somehow without keeping really verbose 
documentation: what do other people think?  Are these cases obscure but 
nevertheless standard cases of getopt since Unix/GNU history? (e.g. it 
seems that compilers behave differently from "normal programs", behave 
differently from everyone else's slightly different implementations of 
arguments)

-Isaac


More information about the Libraries mailing list