tomlcheck 0.1.0.36 → 0.1.0.38
raw patch · 6 files changed
+46/−31 lines, 6 filesdep +optparse-applicativedep −optparse-genericdep ~base
Dependencies added: optparse-applicative
Dependencies removed: optparse-generic
Dependency ranges changed: base
Files
- CHANGELOG.md +4/−0
- README.md +1/−1
- app/Main.hs +28/−22
- cabal.project +2/−0
- cabal.project.local +0/−2
- tomlcheck.cabal +11/−6
+ CHANGELOG.md view
@@ -0,0 +1,4 @@+# 0.1.0.38+ + * Remove dependency on `optparse-generic` as it has spurious dependencies and+ breaks cross-compilation
README.md view
@@ -29,7 +29,7 @@ ### Travis -Add the following your `.travis.yml` file to check a `.toml` file:+Add the following your `.travis.yml` file to check a file called `Config.toml`: ```yaml - curl -sL https://raw.githubusercontent.com/vmchale/tomlcheck/master/sh/check | sh -s Config.toml
app/Main.hs view
@@ -1,36 +1,42 @@-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TypeOperators #-}- module Main ( main ) where import Control.Monad-import qualified Data.Text.IO as TIO-import GHC.Generics (Generic)-import Options.Generic-import System.Exit (ExitCode (..), exitWith)-import Text.Megaparsec (errorBundlePretty)-import Text.Toml (parseTomlDoc)+import qualified Data.Text.IO as TIO+import Data.Version (showVersion)+import Options.Applicative+import Paths_tomlcheck (version)+import System.Exit (ExitCode (..), exitWith)+import Text.Megaparsec (errorBundlePretty)+import Text.Toml (parseTomlDoc) -newtype Program = Program { file :: [FilePath] <?> "Path to file to be checked." }- deriving (Generic)+versionInfo :: Parser (a -> a)+versionInfo = infoOption ("tomlcheck version: " ++ showVersion version) (short 'V' <> long "version" <> help "Show version") -programModifiers :: Modifiers-programModifiers = defaultModifiers { shortNameModifier = firstLetter }+tomlFile :: Parser [FilePath]+tomlFile = some+ (strOption+ (metavar "FILE"+ <> long "file"+ <> short 'f'+ <> help "Path to file to be checked"+ )) -instance ParseRecord Program where- parseRecord = parseRecordWithModifiers programModifiers+wrapper :: ParserInfo [FilePath]+wrapper = info (helper <*> versionInfo <*> tomlFile)+ (fullDesc+ <> progDesc "A TOML syntax checker"+ <> header "tomlcheck - a syntax checker for TOML written in Haskell") main :: IO ()-main = do- x <- getRecord "Command-line wrapper around htoml"- let paths = unHelpful $ file x+main = execParser wrapper >>= run++run :: [FilePath] -> IO ()+run paths = do contents <- traverse TIO.readFile paths case zipWithM parseTomlDoc paths contents of- Right _ -> mempty- Left e -> do+ Right{} -> mempty+ Left e -> do putStrLn $ errorBundlePretty e exitWith (ExitFailure 1)
+ cabal.project view
@@ -0,0 +1,2 @@+packages: ./+constraints: tomlcheck +development
− cabal.project.local
@@ -1,2 +0,0 @@-optimization: 2-constraints: tomlcheck +development
tomlcheck.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: tomlcheck-version: 0.1.0.36+version: 0.1.0.38 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2017-2018 Vanessa McHale@@ -14,8 +14,9 @@ category: Toml, Data build-type: Simple extra-source-files:- cabal.project.local+ cabal.project extra-doc-files: README.md+ CHANGELOG.md source-repository head type: git@@ -30,6 +31,10 @@ executable tomlcheck main-is: Main.hs hs-source-dirs: app+ other-modules:+ Paths_tomlcheck+ autogen-modules:+ Paths_tomlcheck default-language: Haskell2010 other-extensions: DataKinds DeriveGeneric OverloadedStrings TypeOperators@@ -37,15 +42,15 @@ build-depends: base >=4.9 && <5, htoml-megaparsec >=2.1.0.0,- optparse-generic -any,+ optparse-applicative -any, megaparsec >=7.0, text -any- + if flag(development) ghc-options: -Werror- + if impl(ghc >=8.0) ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates- + if impl(ghc >=8.4) ghc-options: -Wmissing-export-lists