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 | where | ||||||
| 
 | 
 | ||||||
| #if MIN_VERSION_githash(0,1,4) |  | ||||||
| import GitHash (giDescribe, tGitInfoCwdTry) | import GitHash (giDescribe, tGitInfoCwdTry) | ||||||
| #else |  | ||||||
| import GitHash (giHash, tGitInfoCwdTry) |  | ||||||
| #endif |  | ||||||
| import System.Info (os, arch) | import System.Info (os, arch) | ||||||
| import Hledger.Utils | import Hledger.Utils | ||||||
| 
 | 
 | ||||||
| @ -62,12 +58,15 @@ buildversion = prettify . splitAtElement '.' $ version ++ patchlevel | |||||||
| 
 | 
 | ||||||
| -- | A string representing the version description of the current package | -- | A string representing the version description of the current package | ||||||
| versiondescription :: String -> String | versiondescription :: String -> String | ||||||
| versiondescription progname = concat | versiondescription progname = concat [ | ||||||
| #if MIN_VERSION_githash(0,1,4) |     progname | ||||||
|     [progname, " ", either (const buildversion) giDescribe gi, ", ", os', "-", arch] |   , " " | ||||||
| #else |   , either (const buildversion) giDescribe gi | ||||||
|     [progname, " ", buildversion, either (const "") (\x -> ", git revision " ++ giHash x) gi, ", ", os', "-", arch] |   , ", " | ||||||
| #endif |   , os' | ||||||
|  |   , "-" | ||||||
|  |   , arch | ||||||
|  |   ] | ||||||
|   where |   where | ||||||
|     gi = $$tGitInfoCwdTry |     gi = $$tGitInfoCwdTry | ||||||
|     os' | os == "darwin"  = "mac" |     os' | os == "darwin"  = "mac" | ||||||
|  | |||||||
| @ -109,7 +109,7 @@ dependencies: | |||||||
| - directory | - directory | ||||||
| - extra >=1.6.3 | - extra >=1.6.3 | ||||||
| - filepath | - filepath | ||||||
| - githash >=0.1.2 | - githash >=0.1.4 | ||||||
| - haskeline >=0.6 | - haskeline >=0.6 | ||||||
| - megaparsec >=7.0.0 && <9.2 | - megaparsec >=7.0.0 && <9.2 | ||||||
| - mtl >=2.2.1 | - mtl >=2.2.1 | ||||||
|  | |||||||
| @ -28,6 +28,7 @@ extra-deps: | |||||||
| - prettyprinter-ansi-terminal-1.1.2 | - prettyprinter-ansi-terminal-1.1.2 | ||||||
| - doctest-0.18.1 | - doctest-0.18.1 | ||||||
| # for hledger: | # for hledger: | ||||||
|  | - githash-0.1.4.0 | ||||||
| # for hledger-ui: | # for hledger-ui: | ||||||
| # for hledger-web: | # for hledger-web: | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user