optparse-applicative 0.4.0 → 0.4.1
raw patch · 3 files changed
+16/−3 lines, 3 files
Files
- Options/Applicative/Builder.hs +3/−2
- optparse-applicative.cabal +1/−1
- tests/Tests.hs +12/−0
Options/Applicative/Builder.hs view
@@ -55,6 +55,7 @@ -- * Internals Mod, HasName,+ HasCompleter, OptionFields, FlagFields, CommandFields,@@ -364,11 +365,11 @@ -- | Builder for an option taking a 'String' argument. strOption :: Mod OptionFields String -> Parser String-strOption m = nullOption $ m & reader str+strOption m = nullOption $ reader str & m -- | Builder for an option using the 'auto' reader. option :: Read a => Mod OptionFields a -> Parser a-option m = nullOption $ m & reader auto+option m = nullOption $ reader auto & m -- | Modifier for 'ParserInfo'. newtype InfoMod a = InfoMod
optparse-applicative.cabal view
@@ -1,5 +1,5 @@ name: optparse-applicative-version: 0.4.0+version: 0.4.1 synopsis: Utilities and combinators for parsing command line options description: Here is a simple example of an applicative option parser:
tests/Tests.hs view
@@ -191,5 +191,17 @@ Right val -> assertFailure $ "unexpected result " ++ show val +case_issue_19 :: Assertion+case_issue_19 = do+ let p = option+ ( short 'x'+ & reader (Just . str)+ & value Nothing )+ i = info (p <**> helper) idm+ result = run i ["-x", "foo"]+ case result of+ Left _ -> assertFailure "unexpected parse error"+ Right r -> Just "foo" @=? r+ main :: IO () main = $(defaultMainGenerator)