-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ new ] version command (with git hash)
Note that the git hash will only be included if you compile the project using `cabal v1-install` because `v2-install` uses a temporary directory outside of the git project to do the build... Cf. acfoltzer/gitrev#23
- Loading branch information
Showing
3 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{-# LANGUAGE TemplateHaskell #-} | ||
|
||
module Mary.Version where | ||
|
||
import Control.Monad (guard) | ||
|
||
import Data.Version (showVersion) | ||
import Development.GitRev | ||
import qualified Paths_mary as Mary | ||
|
||
version :: String | ||
version = showVersion Mary.version ++ maybe "" ('-':) commit | ||
|
||
commit :: Maybe String | ||
commit = do | ||
let hash = $(gitHash) | ||
guard (hash /= "UNKNOWN") | ||
pure $ take 7 hash |