Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 2/3] parse-options: allow positivation of options starting, with no-

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:09

René Scharfe [off-list ref] writes:
Long options can be negated by adding no- right after the leading
two dashes. This is useful e.g. to override options set by aliases.

For options that are defined to start with no- already, this looks
a bit funny. Allow such options to also be negated by removing the
prefix.
True about "a bit funny", but the fact that the solution has to touch
parse-options.c confuses me.

I would naïvely expect that it would be sufficient to update an existing
definition for "--no-frotz" that uses PARSE_OPT_NONEG to instead define
"--frotz" that by itself is a no-op, and "--no-frotz" would cause whatever
the option currently means, with an update to the help text that says
something to the effect that "--frotz by itself is meaningless and is
always used as --no-frotz".

There must be a reason the patch had to take an approach in the opposite
direction to allow removal of --[no-] prefix, but it is not obvious to me
what it is.

Note that I am _not_ saying that this is a bad change. I am just saying
that it is unclear why we still want two different ways to support the
"--no-frotz" option, one by defining "frotz" option that allows "no" to be
prefixed, and the other by defining "no-frotz" that allows "no-" to be
stripped.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help