Re: [PATCH 3/3] parse-options: only insert newline in help text if needed
From: Junio C Hamano <hidden>
Date: 2017-09-25 05:53:35
Junio C Hamano [off-list ref] writes:
Brandon Casey [off-list ref] writes:quoted
Currently, when parse_options() produces a help message it always emits a blank line after the usage text to separate it from the options text. If the option spec does not define any switches, or only defines hidden switches that will not be displayed, then the help text will end up with two trailing blank lines instead of one. Let's defer emitting the blank line between the usage text and the options text until it is clear that the options section will not be empty.This somehow looks familiar. I think (together with the fix in 2/3) this makes it definitely better. I also wonder if we want the final blank line, but that is sort-of a different issue. Thanks.
Oh, no wonder that this looked familiar. It solves the same issue
as 48b8d3cf ("usage_with_options: omit double new line on empty
option list", 2017-08-25) and of course it conflicts with it.
I find the solution presented with this patch is more direct and
straightforward, leaving less chance to future breakage. Besides
it comes with tests ;-), so perhaps I should drop the other one.