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