json-autotype 0.2.1.0 → 0.2.1.1
raw patch · 3 files changed
+26/−5 lines, 3 files
Files
- CLI.hs +20/−0
- LICENSE +4/−4
- json-autotype.cabal +2/−1
+ CLI.hs view
@@ -0,0 +1,20 @@+-- | This module facilitates definition of command line interface.+module CLI (+ defaultOutputFilename+ , withFileOrHandle+ ) where++import System.IO (withFile, stdin, stderr, stdout, IOMode(..), Handle)++-- | Default output filname is used, when there is no explicit output file path, or it is "-" (stdout).+defaultOutputFilename :: FilePath+defaultOutputFilename = "JSONTypes.hs"++-- | Generic function for opening file if the filename is not empty nor "-",+-- or using given handle otherwise (probably stdout, stderr, or stdin).+-- TODO: Should it become utility function?+withFileOrHandle :: FilePath -> IOMode -> Handle -> (Handle -> IO r) -> IO r+withFileOrHandle "" ioMode handle action = action handle+withFileOrHandle "-" ioMode handle action = action handle+withFileOrHandle name ioMode _ action = withFile name ioMode action +
LICENSE view
@@ -1,10 +1,10 @@-Copyright (c) 2014, Michal J. Gajda--All rights reserved.- This repository contains some test JSON examples in test/*.json that is downloaded from Twitter API and http://www.jquery4u.com/json/. Naturally these are covered by other licenses.++Code copyright (c) 2014, Michal J. Gajda++All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
json-autotype.cabal view
@@ -1,6 +1,6 @@ -- Build information for the package. name: json-autotype-version: 0.2.1.0+version: 0.2.1.1 synopsis: Automatic type declaration for JSON input data description: Generates datatype declarations with Aeson's "FromJSON" instances from a set of example ".json" files.@@ -43,6 +43,7 @@ Data.Aeson.AutoType.Util Data.Aeson.AutoType.Extract Data.Aeson.AutoType.Format+ CLI other-extensions: TemplateHaskell, ScopedTypeVariables, OverloadedStrings,