CLI11 icon indicating copy to clipboard operation
CLI11 copied to clipboard

Option to hide the default value in the help text

Open LostInCompilation opened this issue 2 years ago • 1 comments

When I set a flag like this:

app.add_flag("--hidden,!--no-hidden", showHiddenFiles, "Show or hide hidden files");

the resulting help text looks like this:

--hidden, --no-hidden{false}          Show or hide hidden files

It would be nice to have the ability to hide the {false} part. I did not find such an option in the docs/code. Also using a custom formatter doesn't seem to help, since this behaviour is defined in std::string Option::get_name(bool positional, bool all_options).

LostInCompilation avatar Mar 09 '23 23:03 LostInCompilation

The intention was that the option name output should be such that it could be fed into add_option and it would register the same. So no modifiers to hide the {false} part were not considered as they would break that symmetry. Though this may be something we want have a means of doing via a custom formatter of some sort.

phlptp avatar Jul 05 '23 17:07 phlptp