mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-08 07:02:44 +03:00
cli: require githash >=0.1.4.0, simplify version code
This commit is contained in:
parent
606d992fc8
commit
33c5726a96
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user