cli: require githash >=0.1.4.0, simplify version code

This commit is contained in:
Simon Michael 2021-08-05 22:04:20 -10:00
parent 606d992fc8
commit 33c5726a96
3 changed files with 11 additions and 11 deletions

View File

@ -13,11 +13,7 @@ module Hledger.Cli.Version (
)
where
#if MIN_VERSION_githash(0,1,4)
import GitHash (giDescribe, tGitInfoCwdTry)
#else
import GitHash (giHash, tGitInfoCwdTry)
#endif
import System.Info (os, arch)
import Hledger.Utils
@ -62,12 +58,15 @@ buildversion = prettify . splitAtElement '.' $ version ++ patchlevel
-- | A string representing the version description of the current package
versiondescription :: String -> String
versiondescription progname = concat
#if MIN_VERSION_githash(0,1,4)
[progname, " ", either (const buildversion) giDescribe gi, ", ", os', "-", arch]
#else
[progname, " ", buildversion, either (const "") (\x -> ", git revision " ++ giHash x) gi, ", ", os', "-", arch]
#endif
versiondescription progname = concat [
progname
, " "
, either (const buildversion) giDescribe gi
, ", "
, os'
, "-"
, arch
]
where
gi = $$tGitInfoCwdTry
os' | os == "darwin" = "mac"

View File

@ -109,7 +109,7 @@ dependencies:
- directory
- extra >=1.6.3
- filepath
- githash >=0.1.2
- githash >=0.1.4
- haskeline >=0.6
- megaparsec >=7.0.0 && <9.2
- mtl >=2.2.1

View File

@ -28,6 +28,7 @@ extra-deps:
- prettyprinter-ansi-terminal-1.1.2
- doctest-0.18.1
# for hledger:
- githash-0.1.4.0
# for hledger-ui:
# for hledger-web: