optparse-applicative
optparse-applicative copied to clipboard
Allow to tune behavior of the brief description renderer
Context
First of all, thank you @HuwCampbell for your work on optparse-applicative. We (at cardano-cli) are very happy users of optparse-applicative!
This PR allows to tune the behavior of the renderer of descriptions. An option is added that favors vertical alignment when displaying multiple flags, instead of maximizing the use of space on a single line.
The default behavior is unchanged and no change is imposed upon users. This PR solely make it possible for callers that prefer vertical alignment to do so.
Caveats
I am not super savvy about the different options that could be proposed. I have only proposed the existing behavior and the new one, which happen to yield very different results, as the change to the golden file of the changed test exemplifies:
We have many more examples at cardano-cli where we find this change beneficial in terms of readibility of the --help message when there are many flags available. For example:
Here is another one:
History
For the record, this is an improvement that originally comes from https://github.com/pcapriotti/optparse-applicative/pull/428 and which we have maintained in this fork, but we now want to remove this fork, to shrink the spread in the Haskell ecosystem, and reduce maintenance burden.