flags-applicative 0.1.0.1 → 0.1.0.2
raw patch · 4 files changed
+14/−3 lines, 4 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Flags.Applicative: stringVal :: Reader String
Files
- README.md +1/−1
- flags-applicative.cabal +1/−1
- src/Flags/Applicative.hs +6/−1
- test/Spec.hs +6/−0
README.md view
@@ -1,4 +1,4 @@-# Applicative flags [](https://hackage.haskell.org/package/flags-applicative) [](https://travis-ci.org/mtth/flags-applicative)+# Applicative flags [](https://stackage.org/lts/package/flags-applicative) [](https://stackage.org/nightly/package/flags-applicative) [](https://hackage.haskell.org/package/flags-applicative) [](https://travis-ci.org/mtth/flags-applicative) Simple flags parsing, inspired by [`optparse-applicative`](http://hackage.haskell.org/package/optparse-applicative).
flags-applicative.cabal view
@@ -1,5 +1,5 @@ name: flags-applicative-version: 0.1.0.1+version: 0.1.0.2 synopsis: Applicative flag parsing description: https://github.com/mtth/flags-applicative homepage: https://github.com/mtth/flags-applicative
src/Flags/Applicative.hs view
@@ -41,7 +41,7 @@ -- ** Unary flags flag, Reader, -- *** Common readers- autoVal, textVal, fracVal, intVal, enumVal, hostVal,+ autoVal, textVal, stringVal, fracVal, intVal, enumVal, hostVal, -- *** Reader combinators listOf, mapOf, -- * Running parsers@@ -308,6 +308,11 @@ -- since 'autoVal' will expect its values to be double-quoted and might not work as expected. autoVal :: Read a => Reader a autoVal = readEither . T.unpack++-- | Returns a reader for a single string value. This can useful when interfacing with non-text APIs+-- (e.g. 'FilePath') but in general prefer 'textVal'.+stringVal :: Reader String+stringVal = Right . T.unpack -- | Returns a reader for a single text value. textVal :: Reader Text
test/Spec.hs view
@@ -73,6 +73,12 @@ res = parseFlags parser ["--foo=1", "--foo=1"] res `shouldBe` Right (1, []) + it "should support strings" $ do+ let+ parser = flag stringVal "bar" ""+ res = parseFlags parser ["--bar", "abc0"]+ res `shouldBe` Right ("abc0", [])+ it "should support text lists" $ do let parser = flag (listOf textVal) "bar" ""