Commit Graph

401 Commits

Author SHA1 Message Date
Paolo Capriotti
a535c3140e Fixed name of target option. 2014-09-25 14:06:14 +01:00
Paolo Capriotti
26c37f9ecf Restore badges in the README 2014-09-24 19:30:58 +01:00
Paolo Capriotti
5f8a961656 Replace README with documentation 2014-09-24 19:28:21 +01:00
Paolo Capriotti
4e1736a440 Copy documentation on builders to the manual 2014-09-24 18:59:08 +01:00
Paolo Capriotti
d5961f60c1 Add outline for the whole manual 2014-09-24 18:28:15 +01:00
Paolo Capriotti
2d653f9a76 Finish extended tutorial 2014-09-24 18:13:03 +01:00
Paolo Capriotti
353eea06d2 Begin working on the manual 2014-09-23 15:29:04 +01:00
Paolo Capriotti
8ccd36b4d6 Merge pull request #105 from phadej/alternative-readm
Alternative instances for Chunk and ReadM
2014-09-22 11:24:00 +01:00
Oleg Grenrus
b979d510ac Add cabal sandbox files to .gitignore 2014-09-22 12:28:34 +03:00
Oleg Grenrus
af9666c9fd Alternative instances for Chunk and ReadM 2014-09-22 12:27:56 +03:00
Paolo Capriotti
a64910cb5c Add hackage badge and use svg badge for travis 2014-09-22 00:25:09 +01:00
Paolo Capriotti
2d0f4516b3 Fix formatting of CHANGELOG.md 2014-09-12 15:38:42 +01:00
Paolo Capriotti
573e90650d Update upper bound for tasty 2014-09-12 15:27:00 +01:00
Paolo Capriotti
f19b5ef37e Point to latest hackage page 2014-09-01 10:37:21 +01:00
Paolo Capriotti
88b1c8d5e2 Update CHANGELOG 2014-09-01 09:27:01 +01:00
Paolo Capriotti
be207e0a72 Add traversal for help text in ParserResult
It should now be relatively easy to customise the appearance of the generated
help text.

For example, in #54, @amigalemming asks for a way to get rid of the usage line
when a specific error message is displayed.  This is now easy to achieve:

    exec :: ParserPrefs -> ParserInfo a -> IO a
    exec pprefs pinfo = do
      res <- execParserPure pprefs pinfo <$> getArgs
      let f h | isEmpty (helpError h) = h
              | otherwise = h { helpUsage = mempty }
      handleParseResult (overFailure f res)
2014-08-27 16:08:12 +01:00
Paolo Capriotti
2ec4121a8e Return ParserHelp from parseFailure
This makes it possible to customise the final help text without duplicating the
help generation code.
2014-08-27 15:24:51 +01:00
Paolo Capriotti
2d7ef27cbb Remove pragmas for unused extensions
Replace GADTs with existentially quantified types.
2014-08-27 14:44:47 +01:00
Paolo Capriotti
80618c2a6f Add instances for ParserResult 2014-08-27 14:35:40 +01:00
Paolo Capriotti
b9667c2735 Deprecate some of the *execParser* functions
The plan is to keep the parser execution API as lean as possible.  Once the
deprecated definitions are removed, it will be down to essentially three
functions:

- `execParser`: for quick and dirty usage of the library
- `customExecParser`: for general use
- `execParserPure`: when maximum control or customisation is needed

All the other convenience functions can be obtained easily using
`execParserPure` and other utilities like `handleParseResult` and
`getParseResult`.
2014-08-27 14:22:42 +01:00
Paolo Capriotti
bab98fe8ee Export parserFailure (fixes #57)
This should make it easier to define custom variants of `execParser`.  For
example, here is a function to print the help text of a parser:

    showHelpText :: ParserPrefs -> ParserInfo a -> IO ()
    showHelpText pprefs pinfo = handleParseResult . Failure $
      parserFailure pprefs pinfo ShowHelpText mempty

and here is the function requested by #57:

    execParserPure' :: ParserPrefs -> ParserInfo a -> [String] -> ParserResult a
    execParserPure' pprefs pinfo [] = Failure $
      parserFailure pprefs pinfo ShowHelpText mempty
    execParserPure' pprefs pinfo args = execParserPure pprefs pinfo args
2014-08-27 14:03:47 +01:00
Paolo Capriotti
9091b1156f Make option take the reader as a parameter (fixes #63)
This commit implements the plan described in the ticket:

- the `reader` modifier is gone, as well as the `optReader` field of
  `OptionFields`
- `option` now takes the reader as argument
- `nullOption` is now deprecated in favour of `option`
- added `strArgument` as a synonym for `argument str`, to mirror `strOption`
2014-08-25 18:38:28 +01:00
Paolo Capriotti
93818b2737 Update CHANGELOG 2014-08-25 18:17:01 +01:00
Paolo Capriotti
15266068e7 Remove deprecated functions 2014-08-25 14:50:25 +01:00
Paolo Capriotti
84de923bfd Update email in the test package cabal file 2014-08-18 14:09:01 +01:00
Paolo Capriotti
345612368a Update email address 2014-08-18 14:06:26 +01:00
Paolo Capriotti
62f04a19bd Merge pull request #99 2014-08-18 13:40:30 +01:00
Ryoichi KATO
68dd772de4 Do not consume second "--"
Allow something like "grep -- --"
2014-08-15 17:46:22 +09:00
Paolo Capriotti
3b09d5c9fd Switch to tasty
Since tasty depends on optparse-applicative, I've had to move the tests to a
separate package to avoid the cyclic dependency. Also, since updates to
optparse-applicative might break the build for tasty, the test package does not
actually depend on optparse-applicative, but includes its code directly.
2014-08-07 21:09:04 +01:00
Paolo Capriotti
c7152c0d2e Enable builds with multiple GHC versions on Travis 2014-08-06 22:24:48 +01:00
Paolo Capriotti
7ce7c482ff Fix install command 2014-08-06 18:33:57 +01:00
Paolo Capriotti
8b54099dd6 Remove hlint check from travis 2014-08-06 18:27:13 +01:00
Paolo Capriotti
7089de4746 Merge pull request #98 from akc/doc-fix
Fix a few small issues with the documentation
2014-08-06 17:37:16 +01:00
Anders Claesson
c85bd49e4e Fix a few small issues with the documentation 2014-08-06 17:13:09 +01:00
Paolo Capriotti
3a6da4c991 Only enable tests in travis for GHC >= 7.2
Some dependencies of test-framework can't be built with older GHCs.
2014-08-06 16:25:22 +01:00
Paolo Capriotti
1e64faaac7 Import Monoid class for older GHC 2014-08-06 16:20:47 +01:00
Paolo Capriotti
3011620c4e Install happy and alex in travis 2014-08-06 15:09:40 +01:00
Paolo Capriotti
2bb638f286 Disable travis build on GHC 6.12 2014-08-06 15:05:17 +01:00
Paolo Capriotti
657d710f6b Test multiple GHC versions on Travis
Travis configuration based on https://github.com/hvr/multi-ghc-travis.
2014-08-06 15:00:56 +01:00
Paolo Capriotti
9724d60fb0 Bump version to 0.9.1.2 2014-08-06 14:47:24 +01:00
Paolo Capriotti
592801e09c Fix HLint warnings 2014-08-06 14:46:35 +01:00
Paolo Capriotti
3046f88bde Add missing test file to cabal (fixes #97). 2014-07-31 11:27:39 +01:00
Paolo Capriotti
19eed1744b Add Show instance for ParserResult (fixes #95). 2014-07-30 19:15:57 +01:00
Paolo Capriotti
3b375db2d3 Fix warning. 2014-07-30 18:46:48 +01:00
Paolo Capriotti
5c602d9631 Concatenate subparser help texts vertically (fixes #93). 2014-07-23 16:11:01 +01:00
Paolo Capriotti
dc5ba49b05 Update CHANGELOG. 2014-07-23 14:40:32 +01:00
Paolo Capriotti
428c2ef000 Merge pull request #94. 2014-07-23 14:33:18 +01:00
Paolo Capriotti
348c1cfd38 Bump version to 0.9.1. 2014-07-23 14:32:53 +01:00
Paolo Capriotti
07f5a6d806 Refactor customExecParser. 2014-07-23 14:32:06 +01:00
Paolo Capriotti
0cf548007d Remove old link in README. 2014-07-23 14:27:04 +01:00