[Libguestfs] [PATCH v2 2/3] mllib: Use L"..." and S '...' for long and short options.

Pino Toscano ptoscano at redhat.com
Mon Jul 18 15:40:11 UTC 2016


On Monday, 18 July 2016 14:43:03 CEST Richard W.M. Jones wrote:
> > > -  let validate_key key =
> > > -    if String.length key == 0 || key == "-" || key == "--"
> > > -       || key.[0] != '-' then
> > > -      invalid_arg (sprintf "invalid option key: '%s'" key)
> > > +  let validate_key = function
> > > +    | L"" -> invalid_arg "Getopt spec: invalid empty long option"
> > > +    | L"help" -> invalid_arg "Getopt spec: should not have L\"help\""
> > 
> > Theoretically both Arg and the current Getopt allow applications to
> > provide an own handler for --help, instead of the built-in one.
> 
> Sure, but I don't think that's a good idea :-)

Well, I could have avoided that when proposing the final Getopt patch...

Also, there should be the same checks for M"something" of the
L"something" ones.

> > IMHO it'd be better to sort the specs at this point, like done before;
> > otherwise, --help (and potentially any non-hidden built-in option added
> > here) will be shown only at the end of the other specs.
> 
> At the beginning of the list, and it was deliberate.  However it's
> just a matter of preference, and the options could be sorted later.

Well I'd prefer it sorted, since it won't create arbitrary lines of
--help with different order, which look a bit odd.

Also, making everything ordered was basically the reason for the helper
type t, and the mutable state of its specs field.

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20160718/8b664019/attachment.sig>


More information about the Libguestfs mailing list