packages feed

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 view
@@ -1,4 +1,4 @@-# Applicative flags [![Hackage](https://img.shields.io/hackage/v/flags-applicative.svg)](https://hackage.haskell.org/package/flags-applicative) [![Build Status](https://travis-ci.org/mtth/flags-applicative.svg?branch=master)](https://travis-ci.org/mtth/flags-applicative)+# Applicative flags [![Stackage LTS](https://stackage.org/package/flags-applicative/badge/lts)](https://stackage.org/lts/package/flags-applicative) [![Stackage Nightly](https://stackage.org/package/flags-applicative/badge/nightly)](https://stackage.org/nightly/package/flags-applicative) [![Hackage](https://img.shields.io/hackage/v/flags-applicative.svg)](https://hackage.haskell.org/package/flags-applicative) [![Build Status](https://travis-ci.org/mtth/flags-applicative.svg?branch=master)](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" ""