Commit Graph

185 Commits

Author SHA1 Message Date
Paolo Capriotti
0ec923cdb9 Simplify Option type.
Remove extra parameter and continuation field.
2012-07-22 17:06:50 +01:00
Paolo Capriotti
6b5228dcd5 Implement many and some in terms of BindP. 2012-07-22 15:39:55 +01:00
Paolo Capriotti
ac22607166 Add default-less flag' builder.
See documentation of the function for more information.
2012-07-22 15:19:31 +01:00
Paolo Capriotti
b083c41d5a Implement some and many. 2012-07-22 15:18:37 +01:00
Paolo Capriotti
a39708b0b9 Add alternative instance. 2012-07-22 15:07:11 +01:00
Paolo Capriotti
895a31b92d Restructure the Parser GADT into a tree. 2012-07-22 15:02:16 +01:00
Paolo Capriotti
3c9d67fb0f Add internal options.
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.
2012-07-21 11:39:01 +01:00
Paolo Capriotti
b5e820e473 Bump version to 0.2.0. 2012-07-21 11:23:41 +01:00
Paolo Capriotti
11f93c230e Fix typo in README. 2012-07-21 00:51:38 +01:00
Paolo Capriotti
e4aa8b81ad Tweak README. 2012-07-21 00:51:05 +01:00
Paolo Capriotti
100ab86ab5 Change version to 0.1.1. 2012-07-21 00:15:13 +01:00
Paolo Capriotti
72c96cb848 Update CHANGELOG. 2012-07-21 00:13:42 +01:00
Paolo Capriotti
e4a4d5402c Add a README paragraph about the arrow interface. 2012-07-20 22:51:46 +01:00
Paolo Capriotti
4a83be1e74 Document the Arrow interface. 2012-07-20 22:37:22 +01:00
Paolo Capriotti
ba941420d5 Fix dependency in test suite. 2012-07-17 20:10:52 +01:00
Paolo Capriotti
d81f02bed7 Bump version to 0.2.0. 2012-07-17 20:02:53 +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
80ea53d20d Add Arrow interface. 2012-07-07 23:23:56 +01:00
Paolo Capriotti
62c2de230b Add CHANGELOG. 2012-07-07 20:56:49 +01:00
Paolo Capriotti
72dab3df1f Improve spacing in help text (fixes #4). 2012-07-07 20:54:24 +01:00
Paolo Capriotti
07ccdae312 Fix test dependencies. 2012-07-07 20:49:58 +01:00
Paolo Capriotti
420dda52f5 Bump version to 0.1.0. 2012-07-07 20:30:40 +01:00
Paolo Capriotti
049534ae7f Add a more involved example and test. 2012-07-07 20:30:01 +01:00
Paolo Capriotti
f5e4104bfa Fix P monad context.
Use a Context with an existential type parameter containing both the
current command and the current parser.
2012-07-07 20:23:40 +01:00
Paolo Capriotti
247bcea581 Better error handling.
Allow parsers to return errors and ParserDesc. Now failure from within a
subparser will show the correct help text (fixes #3).
2012-07-07 18:17:29 +01:00
Paolo Capriotti
065e0683b3 Factor ParserDesc out of ParserInfo. 2012-07-07 11:31:43 +01:00
Paolo Capriotti
32cb69ae06 Remove TH dependency.
Write lens definition manually so we don't need to depend on
data-lens-template and template-haskell.
2012-07-07 00:41:33 +01:00
Paolo Capriotti
4bee34ad4f Fix greet function in Hello example. 2012-06-11 22:42:45 +01:00
Paolo Capriotti
b92be315c9 Documentation tweak. 2012-06-09 19:47:00 +01:00
Paolo Capriotti
df9d3a82b7 Update usage of info in the cabal file. 2012-06-09 01:02:47 +01:00
Paolo Capriotti
a2ba8bd30e Add syntax highlighting to README.md. 2012-06-09 00:58:06 +01:00
Paolo Capriotti
5f7d3aa5b7 Laxer constraint on base dependency. 2012-06-09 00:40:00 +01:00
Paolo Capriotti
678ae22032 Update Travis configuration. 2012-06-09 00:39:05 +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
4532dcaef7 Extract a pure function from execParser.
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).
2012-06-09 00:13:59 +01:00
Paolo Capriotti
284b20348f Add Travis CI configuration and status. 2012-06-08 23:14:26 +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
36547475bf Update usages of info in the documentation.
The documentation was still using the old syntax for specifying a
`ParserInfo`.
2012-06-08 21:40:10 +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
fd8732ef86 Merge pull request #1 from michaelt/patch-1
Fix link to blog post (#1).
2012-05-17 08:04:24 -07:00
Michael Thompson
6a29e323b1 wrong link to your blogpost 2012-05-17 16:54:04 +02:00
Paolo Capriotti
e79d0322b9 Add transform modifier.
Add a modifier to apply a general function to the return value of an
`Option`.
2012-05-14 21:27:45 +01:00
Paolo Capriotti
dff4ce4165 Use short tutorial as package description.
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.
2012-05-12 18:54:53 +01:00
Paolo Capriotti
e90c5795d5 Add more documentation to README.
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.
2012-05-12 18:21:40 +01:00
Paolo Capriotti
bcdac130b0 Rename 'combinator' to 'modifier' in the docs.
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.
2012-05-12 18:19:24 +01:00
Paolo Capriotti
409eeb17ab Add a "Getting started" section to README.
I added a short tutorial based on the `hello` example, and some
information about the internals.
2012-05-12 16:42:37 +01:00
Paolo Capriotti
a2c436cae8 Add default value to flag builder.
There is no point in having a flag without a default value, so I added
it as an extra argument to the `flag` builder.
2012-05-12 16:16: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
b9706921a3 Fix newlines in command description.
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.
2012-05-12 15:59:45 +01:00