packages feed

configuration-tools 0.2.4 → 0.2.4.1

raw patch · 5 files changed

+47/−10 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+0.2.4.1+=======++*   Support for optparse-applicative >= 0.10.+ 0.2.4 ===== 
configuration-tools.cabal view
@@ -3,7 +3,7 @@ -- ------------------------------------------------------ --  Name:                configuration-tools-Version:             0.2.4+Version:             0.2.4.1 Synopsis:            Tools for specifying and parsing configurations description:     Tools for specifying and parsing configurations@@ -54,7 +54,7 @@ source-repository this     type: git     location: https://github.com/alephcloud/hs-configuration-tools.git-    tag: 0.2.4+    tag: 0.2.4.1  Library     hs-source-dirs: src
constraints view
@@ -11,7 +11,7 @@              bytestring ==0.10.4.0,              comonad ==4.2,              conduit ==1.1.6,-             configuration-tools ==0.2.4,+             configuration-tools ==0.2.4.1,              containers ==0.5.5.1,              contravariant ==0.6,              deepseq ==1.3.0.2,@@ -32,7 +32,7 @@              mtl ==2.1.3.1,              nats ==0.2,              old-locale ==1.0.0.6,-             optparse-applicative ==0.9.0,+             optparse-applicative ==0.10.0,              prelude-extras ==0.4,              pretty ==1.1.1.1,              primitive ==0.5.3.0,
src/Configuration/Utils.hs view
@@ -9,6 +9,7 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE CPP #-}  {-# OPTIONS_HADDOCK show-extensions #-} @@ -108,7 +109,12 @@ import qualified Data.Text as T import qualified Data.Yaml as Yaml +#if MIN_VERSION_optparse_applicative(0,10,0)+import Options.Applicative hiding (Parser, Success)+#else import Options.Applicative hiding (Parser, Success, (&))+#endif+ import qualified Options.Applicative as O  import Prelude.Unicode@@ -482,6 +488,14 @@         ⊕ O.short 'p'         ⊕ O.help "Print the parsed configuration to standard out and exit"         ⊕ O.showDefault+#if MIN_VERSION_optparse_applicative(0,10,0)+    <*> O.option (O.eitherReader $ \file → fileReader file <*> pure d)+        × O.long "config-file"+        ⊕ O.short 'c'+        ⊕ O.metavar "FILE"+        ⊕ O.help "Configuration file in YAML format"+        ⊕ O.value d+#else     <*> O.nullOption         × O.long "config-file"         ⊕ O.short 'c'@@ -489,6 +503,7 @@         ⊕ O.help "Configuration file in YAML format"         ⊕ O.eitherReader (\file → fileReader file <*> pure d)         ⊕ O.value d+#endif   where     fileReader file = fmapL (\e → "failed to parse configuration file " ⊕ file ⊕ ": " ⊕ show e)         $ unsafePerformIO (Yaml.decodeFileEither file)@@ -651,20 +666,20 @@ -- enough to wrap the parsed value into 'Just'. -- -- > data LogConfig = LogConfig--- >    { _logLevel :: !Int--- >    , _logFile :: !(Maybe String)+-- >    { _logLevel ∷ !Int+-- >    , _logFile ∷ !(Maybe String) -- >    } -- > -- > $(makeLenses ''LogConfig) -- >--- > defaultLogConfig :: LogConfig+-- > defaultLogConfig ∷ LogConfig -- > defaultLogConfig = LogConfig -- >     { _logLevel = 1 -- >     , _logFile = Nothing -- >     } -- >--- > instance FromJSON (LogConfig -> LogConfig) where--- >     parseJSON = withObject "LogConfig" $ \o -> id+-- > instance FromJSON (LogConfig → LogConfig) where+-- >     parseJSON = withObject "LogConfig" $ \o → id -- >         <$< logLevel ..: "LogLevel" % o -- >         <*< logFile ..: "LogConfig" % o -- >@@ -674,9 +689,13 @@ -- >         , "LogConfig" .= _logFile config -- >         ] -- >--- > pLogConfig :: MParser LogConfig+-- > pLogConfig ∷ MParser LogConfig -- > pLogConfig = id+-- > #if MIN_VERSION_optparse-applicative(0,10,0)+-- >     <$< logLevel .:: option auto+-- > #else -- >     <$< logLevel .:: option+-- > #endif -- >         % long "log-level" -- >         % metavar "INTEGER" -- >         % help "log level"
src/Configuration/Utils/Http.hs view
@@ -7,6 +7,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE CPP #-}  {-# OPTIONS_HADDOCK show-extensions #-} @@ -167,10 +168,18 @@     <$< hscHost ∘ bs .:: strOption         × long (prefix ⊕ "host")         ⊕ help "Hostname of the service"+#if MIN_VERSION_optparse_applicative(0,10,0)+    <*< hscPort .:: option auto+#else     <*< hscPort .:: option+#endif         × long (prefix ⊕ "port")         ⊕ help "Port of the service"+#if MIN_VERSION_optparse_applicative(0,10,0)+    <*< hscInterface ∘ bs .:: option auto+#else     <*< hscInterface ∘ bs .:: option+#endif         × long (prefix ⊕ "interface")         ⊕ help "Interface of the service"     <*< (hscUseTLS %:: (fmap <$> pHttpServiceTLSConfiguration prefix))@@ -225,7 +234,11 @@     <$< hccHost ∘ bs .:: strOption         × long (serviceName ⊕ "-host")         ⊕ help ("Hostname of " ⊕ serviceName)+#if MIN_VERSION_optparse_applicative(0,10,0)+    <*< hccPort .:: option auto+#else     <*< hccPort .:: option+#endif         × long (serviceName ⊕ "-port")         ⊕ help ("Port of " ⊕ serviceName)     <*< hccUseTLS .:: switch