optparse-generic 1.1.3 → 1.1.4
raw patch · 2 files changed
+17/−4 lines, 2 filesdep +semigroups
Dependencies added: semigroups
Files
- optparse-generic.cabal +4/−2
- src/Options/Generic.hs +13/−2
optparse-generic.cabal view
@@ -1,5 +1,5 @@ Name: optparse-generic-Version: 1.1.3+Version: 1.1.4 Cabal-Version: >=1.8.0.2 Build-Type: Simple License: BSD3@@ -30,7 +30,9 @@ optparse-applicative >= 0.11.0 && < 0.14, time >= 1.5 && < 1.7 , void < 0.8 ,- bytestring < 0.11+ bytestring < 0.11,+ semigroups >= 0.5.0 && < 0.19+ if impl(ghc < 7.8) Build-Depends: singletons >= 0.10.0 && < 1.0 ,
src/Options/Generic.hs view
@@ -235,6 +235,7 @@ import Control.Monad.IO.Class (MonadIO(..)) import Data.Char (toLower, toUpper) import Data.Monoid+import Data.List.NonEmpty (NonEmpty((:|))) import Data.Proxy import Data.Text (Text) import Data.Typeable (Typeable)@@ -476,6 +477,9 @@ instance ParseField a => ParseFields [a] where parseFields = parseListOfField +instance ParseField a => ParseFields (NonEmpty a) where+ parseFields h m = (:|) <$> parseField h m <*> parseListOfField h m+ {-| Use this to annotate a field with a type-level string (i.e. a `Symbol`) representing the help description for that field: @@ -589,6 +593,9 @@ instance ParseField a => ParseRecord [a] where parseRecord = fmap getOnly parseRecord +instance ParseField a => ParseRecord (NonEmpty a) where+ parseRecord = fmap getOnly parseRecord+ instance (ParseFields a, ParseFields b) => ParseRecord (a, b) instance (ParseFields a, ParseFields b, ParseFields c) => ParseRecord (a, b, c) instance (ParseFields a, ParseFields b, ParseFields c, ParseFields d) => ParseRecord (a, b, c, d)@@ -776,8 +783,12 @@ => Text -- ^ Program description -> io a-getRecord desc = liftIO (Options.execParser info)+getRecord desc = liftIO (Options.customExecParser prefs info) where+ prefs = Options.defaultPrefs+ { Options.prefMultiSuffix = "..."+ }+ header = Options.header (Data.Text.unpack desc) info = Options.info parseRecord header@@ -799,7 +810,7 @@ -> Maybe a getRecordPure args = do let prefs = Options.ParserPrefs- { prefMultiSuffix = ""+ { prefMultiSuffix = "..." , prefDisambiguate = False , prefShowHelpOnError = False , prefBacktrack = True