optparse-simple 0.1.0 → 0.1.1
raw patch · 4 files changed
+55/−19 lines, 4 filesdep +githashdep +semigroupsdep −gitrevdep ~basenew-component:exe:simplePVP ok
version bump matches the API change (PVP)
Dependencies added: githash, semigroups
Dependencies removed: gitrev
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- example/Simple.hs +8/−0
- optparse-simple.cabal +29/−8
- src/Options/Applicative/Simple.hs +14/−11
ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.1.1++* Switch dependency `gitrev` to `githash`+ ## 0.1.0 * Migrate from `EitherT` to `ExceptT`
+ example/Simple.hs view
@@ -0,0 +1,8 @@+{-# LANGUAGE TemplateHaskell #-}+module Main (main) where++import Options.Applicative.Simple (simpleVersion)+import qualified Paths_optparse_simple as Meta++main :: IO ()+main = putStrLn $(simpleVersion Meta.version)
optparse-simple.cabal view
@@ -1,11 +1,13 @@--- This file has been generated from package.yaml by hpack version 0.20.0.+cabal-version: 1.12++-- This file has been generated from package.yaml by hpack version 0.30.0. -- -- see: https://github.com/sol/hpack ----- hash: 5955f8eb9562e24b8a68ecf2cb4c0674a9de7508574a10a44469d8e88bbebdb9+-- hash: fedb382b497ac88d5626d78481bca7e81964fa673d0aebf67c05ed96c7883775 name: optparse-simple-version: 0.1.0+version: 0.1.1 synopsis: Simple interface to optparse-applicative description: Please see the README at <https://www.stackage.org/package/optparse-simple> category: Options@@ -17,30 +19,49 @@ license: BSD3 license-file: LICENSE build-type: Simple-cabal-version: >= 1.10- extra-source-files:- ChangeLog.md README.md+ ChangeLog.md source-repository head type: git location: https://github.com/fpco/optparse-simple +flag build-example+ description: Build the example executable+ manual: True+ default: False+ library hs-source-dirs: src/ ghc-options: -Wall build-depends:- base >=4 && <5- , gitrev+ base >=4.9.1 && <5+ , githash >=0.1.3.0 , optparse-applicative , template-haskell , transformers >=0.4+ if impl (ghc < 8.0)+ build-depends:+ semigroups ==0.18.* exposed-modules: Options.Applicative.Simple other-modules: Paths_optparse_simple+ default-language: Haskell2010++executable simple+ main-is: example/Simple.hs+ other-modules:+ Paths_optparse_simple+ build-depends:+ base >=4.9.1 && <5+ , optparse-simple+ if flag(build-example)+ buildable: True+ else+ buildable: False default-language: Haskell2010 test-suite test
src/Options/Applicative/Simple.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE CPP #-} -- | Simple interface to program arguments. --@@ -41,9 +42,11 @@ import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.Except import Control.Monad.Trans.Writer-import Data.Monoid+#if !MIN_VERSION_base(4,11,0)+import Data.Semigroup+#endif import Data.Version-import Development.GitRev (gitDirty, gitHash)+import GitHash (giDirty, giHash, tGitInfoCwdTry) import Language.Haskell.TH (Q,Exp) import qualified Language.Haskell.TH.Syntax as TH import Options.Applicative@@ -83,15 +86,15 @@ [|concat (["Version " ,$(TH.lift $ showVersion version) ] ++- if $gitHash == ("UNKNOWN" :: String)- then []- else- [", Git revision "- ,$gitHash- ,if $gitDirty- then " (dirty)"- else ""- ])|]+ case giResult of+ Left _ -> []+ Right gi -> [ ", Git revision "+ , giHash gi+ , if giDirty gi then " (dirty)" else ""+ ]+ )|]+ where+ giResult = $$tGitInfoCwdTry -- | Add a command to the options dispatcher. addCommand :: String -- ^ command string