Change the previous `optShow` boolean field in `Option` to an
`optVisibility` field which can be set to Visible, Hidden, or Internal.
Internal means that the option will not be shown in the help text at
all.
Add a new `internal` modifier to create internal options, and rename the
`hide` modifier to `hidden` for consistency.
The examples are now part of the test executable, and the test work by
using `execParserPure` instead of actually running the program and
capturing stderr.
This is a slightly less accurate test, but a lot cleaner and simpler to
maintain.
Decompose execParser into a pure function execParserPure (useful for
testing and custom argument parsing), and an effectful function (which
prints the error message to stderr, and exits the program).
Add module `Options.Applicative`, which re-exports the whole package (and
`Control.Applicative` as well).
Now the package can be used after a single import:
import Options.Applicative
The interaction between the cabal file syntax and haddock markup is
somewhat broken, so I had to use explicit hex entities to display
braces and prevent cabal from eating the indentation.
Add more information on supported option kinds, builders and modifiers,
with some examples.
A few things are still undocumented, like `ParserInfo`, help
generation and multi-valued options.
Modifier is a much more specific and clearer name. There is really no
need to distinguish between "basic" modifiers (i.e. provided by the
library) from those created by composition.
Add builder to make it easier to create a simple boolean flag. The
`switch` builder is just a `flag` with default value `False` and active
value `True`.
The definition of cmdDesc was erroneously changed while adding
documentation, and it was using `unlines` instead of `intercalate "\n"`,
thus adding an extraneous newline at the end.