optparse-applicative icon indicating copy to clipboard operation
optparse-applicative copied to clipboard

More advanced flag help support

Open jokesper opened this issue 1 year ago • 2 comments

While looking at how other programs handle flags I found some special cases:

  1. --[no-]xxxx, which is a pair of flags to override a boolean value, with one help and different resulting values. listing them both would also be ok (--xxxx, --no-xxxx) So this is a request of having one help for multiple options.
  2. -Wxxx, which is often used to enable warnings in compilers, -W as a short flag is trivial, but we want to have multiple help pages per option with expanded valid values.

So I would like help pages not having to be in a 1:1 relation with options.

jokesper avatar Oct 07 '24 20:10 jokesper

This duplicates https://github.com/pcapriotti/optparse-applicative/issues/243 and https://github.com/pcapriotti/optparse-applicative/issues/148.

I should put up a wiki page on some of these.

HuwCampbell avatar Jun 10 '25 09:06 HuwCampbell

Not quite, my request is about decoupeling help pages from options.

We already can implement --no-xxx and --xxx but either one has no help, we group them in a bigger block, have a short help in --no-xxx: "Disable xxx, see --xxx". I would want the ability to have one help page for multiple options. Even though #148 is nice to have, this would be an orthogonal feature though nice to have together. Another example of the usefulness, is with flags, which have been renamed in the past so we list both under the same help.

The 2. is also not a duplicate of #243. It's about a shortflag with a required parameter. Though since there is a lot of behaviour in determined based on the value, we want to have a help for each value. For example:

--warning=all
   Enables all warnings, this includes ...
--warning=unused-variables
  Warn when variables are declared without being used

instead of

--warning=WARNING

  all
    Enables all warnings, this includes ...

  unused-variables
    Warn when variables are declared without being used

jokesper avatar Jun 10 '25 11:06 jokesper