remkop / picocli

Picocli is a modern framework for building powerful, user-friendly, GraalVM-enabled command line apps with ease. It supports colors, autocompletion, subcommands, and more. In 1 source file so apps can include as source & avoid adding a dependency. Written in Java, usable from Groovy, Kotlin, Scala, etc.
https://picocli.info
Apache License 2.0
4.8k stars 414 forks source link

Documentation unclear re. default for negatable options #2217

Closed dbear496 closed 3 months ago

dbear496 commented 4 months ago

I am new to picocli, so I'm perusing the documentation to see how I can use it in my project. I came across the following section on negatable options which is a bit unclear:

Screenshot_20240227_103009

This clearly states, "If the negated form of the option is found, for example --no-verbose, the value is set to the provided default. Otherwise, with a regular call, for example --verbose, it is set to the opposite of the default." However, the truth table that follows seems to indicate the exact opposite: when --backup has a defaultValue true, then --no-backup sets the value to false, and --backup sets the value to true. Which is it? It looks like these are contradicting.

remkop commented 4 months ago

@dbear496 thank you for raising this. I agree this is confusing. I believe the truth table is correct. It is no longer the case that the value is toggled from the default.

The docs should be modified to clarify that the negated form (for example, --no-verbose) sets the value to false, while the regular form (for example, --verbose) sets the value to true.

Will you be able to provide a pull request with a doc (docs/index.adoc) fix?

dbear496 commented 4 months ago

Thank you for the clarification. Unfortunately, I'm not going to have the time to make a PR for this change.