dhall-json 1.2.5 → 1.2.6
raw patch · 3 files changed
+50/−7 lines, 3 filesdep ~dhallPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: dhall
API changes (from Hackage documentation)
Files
- CHANGELOG.md +11/−0
- dhall-json.cabal +5/−3
- dhall-to-json/Main.hs +34/−4
CHANGELOG.md view
@@ -1,3 +1,14 @@+1.2.6++* Add `--version` flag+ * See: https://github.com/dhall-lang/dhall-haskell/pull/704+* Build against `tasty-1.2`+ * See: https://github.com/dhall-lang/dhall-haskell/pull/731+* Add `--compact` flag to `dhall-to-json`+ * Eventually `--pretty` will become the default, so this flag provides a+ way for a user to preserve the old 1-line output when that happens+ * See: https://github.com/dhall-lang/dhall-haskell/pull/743+ 1.2.5 * Build against `dhall-1.19.0`
dhall-json.cabal view
@@ -1,5 +1,5 @@ Name: dhall-json-Version: 1.2.5+Version: 1.2.6 Cabal-Version: >=1.8.0.2 Build-Type: Simple Tested-With: GHC == 7.10.2, GHC == 8.0.1@@ -35,7 +35,7 @@ Build-Depends: base >= 4.8.0.0 && < 5 , aeson >= 1.0.0.0 && < 1.5 ,- dhall >= 1.19.0 && < 1.20,+ dhall >= 1.19.0 && < 1.21, optparse-applicative >= 0.14.0.0 && < 0.15, text >= 0.11.1.0 && < 1.3 , unordered-containers < 0.3@@ -54,6 +54,8 @@ dhall-json , optparse-applicative , text+ Other-Modules:+ Paths_dhall_json GHC-Options: -Wall Executable dhall-to-yaml@@ -80,6 +82,6 @@ bytestring , dhall , dhall-json ,- tasty < 1.2,+ tasty < 1.3, text , tasty-hunit >= 0.2
dhall-to-json/Main.hs view
@@ -4,8 +4,11 @@ module Main where +import Control.Applicative ((<|>)) import Control.Exception (SomeException)+import Control.Monad (when) import Data.Monoid ((<>))+import Data.Version (showVersion) import Dhall.JSON (Conversion) import Options.Applicative (Parser, ParserInfo) @@ -19,6 +22,7 @@ import qualified Dhall.JSON import qualified GHC.IO.Encoding import qualified Options.Applicative+import qualified Paths_dhall_json as Meta import qualified System.Exit import qualified System.IO @@ -26,6 +30,7 @@ { explain :: Bool , pretty :: Bool , omitNull :: Bool+ , version :: Bool , conversion :: Conversion } @@ -34,6 +39,7 @@ explain <- parseExplain pretty <- parsePretty omitNull <- parseOmitNull+ version <- parseVersion conversion <- Dhall.JSON.parseConversion return (Options {..}) where@@ -44,17 +50,37 @@ ) parsePretty =- Options.Applicative.switch- ( Options.Applicative.long "pretty"- <> Options.Applicative.help "Pretty print generated JSON"- )+ prettyFlag <|> compactFlag <|> defaultBehavior+ where+ prettyFlag =+ Options.Applicative.flag'+ True+ ( Options.Applicative.long "pretty"+ <> Options.Applicative.help "Pretty print generated JSON"+ ) + compactFlag =+ Options.Applicative.flag'+ False+ ( Options.Applicative.long "compact"+ <> Options.Applicative.help "Render JSON on one line"+ )++ defaultBehavior =+ pure False+ parseOmitNull = Options.Applicative.switch ( Options.Applicative.long "omitNull" <> Options.Applicative.help "Omit record fields that are null" ) + parseVersion =+ Options.Applicative.switch+ ( Options.Applicative.long "version"+ <> Options.Applicative.help "Display version"+ )+ parserInfo :: ParserInfo Options parserInfo = Options.Applicative.info@@ -68,6 +94,10 @@ GHC.IO.Encoding.setLocaleEncoding GHC.IO.Encoding.utf8 Options {..} <- Options.Applicative.execParser parserInfo++ when version $ do+ putStrLn (showVersion Meta.version)+ System.Exit.exitSuccess handle $ do let config = Data.Aeson.Encode.Pretty.Config