optparse-generic 1.4.7 → 1.4.8
raw patch · 3 files changed
+32/−11 lines, 3 files
Files
- CHANGELOG.md +7/−0
- optparse-generic.cabal +5/−5
- src/Options/Generic.hs +20/−6
CHANGELOG.md view
@@ -1,3 +1,10 @@+1.4.8++* [Improve handling of `NonEmpty`](https://github.com/Gabriella439/optparse-generic/pull/98)+* [Add `getWithHelpWith`](https://github.com/Gabriella439/Haskell-Optparse-Generic-Library/pull/94)+* [Build against `optparse-applicative-0.17`](https://github.com/Gabriella439/Haskell-Optparse-Generic-Library/pull/92)+* [Build against `text-2.0`](https://github.com/Gabriella439/optparse-generic/pull/91)+ 1.4.7 * [Derive `Data` instances for exported types](https://github.com/Gabriel439/Haskell-Optparse-Generic-Library/pull/89)
optparse-generic.cabal view
@@ -1,11 +1,11 @@ Name: optparse-generic-Version: 1.4.7+Version: 1.4.8 Cabal-Version: >=1.10 Build-Type: Simple License: BSD3 License-File: LICENSE-Copyright: 2016 Gabriel Gonzalez-Author: Gabriel Gonzalez+Copyright: 2016 Gabriella Gonzalez+Author: Gabriella Gonzalez Maintainer: Gabriel439@gmail.com Tested-With: GHC == 7.8.4, GHC == 7.10.2, GHC == 8.0.1 Bug-Reports: https://github.com/Gabriel439/Haskell-Optparse-Generic-Library/issues@@ -26,11 +26,11 @@ Build-Depends: base >= 4.7 && < 5 , system-filepath >= 0.3.1 && < 0.5 ,- text < 1.3 ,+ text < 2.1 , transformers >= 0.2.0.0 && < 0.7 , transformers-compat >= 0.3 && < 0.8 , Only < 0.2 ,- optparse-applicative >= 0.16.0.0 && < 0.17,+ optparse-applicative >= 0.16.0.0 && < 0.18, time >= 1.5 && < 1.13, void < 0.8 , bytestring < 0.12
src/Options/Generic.hs view
@@ -288,6 +288,7 @@ -- * Parsers getRecord , getRecordWith+ , getWithHelpWith , getWithHelp , getRecordPure , getRecordPureWith@@ -359,9 +360,10 @@ import qualified Data.Typeable import qualified Data.ByteString import qualified Data.ByteString.Lazy-import qualified Filesystem.Path.CurrentOS as Filesystem-import qualified Options.Applicative as Options-import qualified Options.Applicative.Types as Options+import qualified Filesystem.Path.CurrentOS as Filesystem+import qualified Options.Applicative as Options+import qualified Options.Applicative.Types as Options+import qualified Options.Applicative.NonEmpty as Options.NonEmpty import qualified Text.Read #if MIN_VERSION_base(4,7,0)@@ -652,7 +654,7 @@ parseFields = parseListOfField instance ParseField a => ParseFields (NonEmpty a) where- parseFields h m c d = (:|) <$> parseField h m c d <*> parseListOfField h m c d+ parseFields h m c d = Options.NonEmpty.some1 (parseField h m c d) {-| Use this to annotate a field with a type-level string (i.e. a `Symbol`) representing the help description for that field:@@ -1133,8 +1135,20 @@ -- ^ Program description -> io (a, io ()) -- ^ (options, io action to print help message)-getWithHelp desc = do- a <- getRecordWith header mempty+getWithHelp desc = getWithHelpWith desc mempty++-- | Marshal any value that implements `ParseRecord` from the commmand line+-- alongside an io action that prints the help message.+getWithHelpWith+ :: (MonadIO io, ParseRecord a)+ => Text+ -- ^ Program description+ -> Options.PrefsMod+ -- ^ 'ParserPrefs' modifiers+ -> io (a, io ())+ -- ^ (options, io action to print help message)+getWithHelpWith desc prefsMods = do+ a <- getRecordWith header prefsMods return (a, help) where header = Options.header (Data.Text.unpack desc)