On Thu, Nov 08, 2007 at 11:59:27PM +0000, Junio C Hamano wrote:
Well, you could do the same by hand, in the callback:
if (unset)
return error("go away with your --no-%s", opt->long_name); This is correct because only long options can be negated, and if the
callback returns -1 (< 0 actually IIRC, or maybe even !0) then
parse_options assume that you dealt with the error message, and will
just print out the usage and exit(129).
So it merely offloads something that you could already do the very
same way _when using a callback_.
It gets more interesting when you want to use an
OPT_INT/_STRING/whatever with an argument that isn't a callback and
don't want for some reason that --no-foo works. Before that change, you
needed a callback, now you don't :)