Commit Graph

23 Commits

Author SHA1 Message Date
Paolo Capriotti
b8841a5abc Add regression test for #16. 2012-08-02 00:49:19 +01:00
Paolo Capriotti
573162700c Fix Context for nested commands. 2012-08-01 20:27:51 +01:00
Paolo Capriotti
551562a4bf Show alternatives in the brief help text. 2012-07-31 17:32:27 +01:00
Paolo Capriotti
9fa5d8a42a Check that only one branch of an Alt is taken. 2012-07-31 14:05:53 +01:00
Paolo Capriotti
50ff2911a7 Add modifiers to show default value.
Add new `showDefault` and `showDefaultWith` modifiers, which will result
in the default value (if present) to be displayed in the help text.

Fixes #12.
2012-07-30 21:17:13 +01:00
Paolo Capriotti
091508459e Replace "Common" with "Available" in help text.
"Common options" was intended as "all except internal", but it could be
interpreted as "global options" for a parser with commands.

Remove the possible confusion by using "Available options" instead,
which is also consistent with the label used for commands.
2012-07-30 19:13:13 +01:00
Paolo Capriotti
0ff4f790ab Add ParserPrefs. 2012-07-22 20:13:01 +01:00
Paolo Capriotti
a4c60b10b1 Fix help text for non-mandatory options.
Options that were not mandatory because part of an AltP expression were
not correctly rendered.

Fixed by using the OptHelpInfo argument in mapParser.
2012-07-22 19:49:45 +01:00
Paolo Capriotti
e8b0e8c705 Implement standard behavior for arguments.
The `arguments` builder now creates a specialized infinite parser that
skips arguments starting with '-', and turns into a normal `many arg`
when a `--` is found.

Fixes #6.
2012-07-22 17:50:07 +01:00
Paolo Capriotti
d3ead53acd Add test for the alternative instance. 2012-07-22 17:12:23 +01:00
Paolo Capriotti
0ec923cdb9 Simplify Option type.
Remove extra parameter and continuation field.
2012-07-22 17:06:50 +01:00
Paolo Capriotti
2dcf5d6602 Fix ordering of elements returned by multi.
The `multi` modifier accumulates parsed values in reverse order, so fix
it by adding a call to `reverse` to `optCont`.

Fixes #7.
2012-07-17 20:00:05 +01:00
Paolo Capriotti
612b0de15c Convert Cabal example to arrows. 2012-07-07 23:28:30 +01:00
Paolo Capriotti
72dab3df1f Improve spacing in help text (fixes #4). 2012-07-07 20:54:24 +01:00
Paolo Capriotti
049534ae7f Add a more involved example and test. 2012-07-07 20:30:01 +01:00
Paolo Capriotti
4bee34ad4f Fix greet function in Hello example. 2012-06-11 22:42:45 +01:00
Paolo Capriotti
e03340b2bf Do not build examples anymore.
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.
2012-06-09 00:17:08 +01:00
Paolo Capriotti
db3ed17e1e Add top-level module.
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
2012-06-08 23:03:21 +01:00
Paolo Capriotti
dfc07b02a6 Add builder for ParserInfo.
Convert `ParserInfo` to use lenses, and add a builder and modifiers to
create a `ParserInfo` object using the same syntax as for options.
2012-05-18 18:29:50 +01:00
Paolo Capriotti
0fa5f170ff Add boolean switch builder.
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`.
2012-05-12 16:16:42 +01:00
Paolo Capriotti
6950f44a19 Add module export lists. 2012-05-09 23:10:37 +01:00
Paolo Capriotti
94189dac63 Add command help. 2012-05-09 22:30:14 +01:00
Paolo Capriotti
1eff2d9c6b Add tests. 2012-05-09 22:06:24 +01:00