Skip to content
Permalink
Browse files

Add git hash to version string

  • Loading branch information
ad-si committed Jan 8, 2020
1 parent 8d0657c commit 5f7b1ef0a03b5fc94fe6b09745370096ed14fcd8
Showing with 22 additions and 10 deletions.
  1. +21 −10 tasklite-core/app/Main.hs
  2. +1 −0 tasklite-core/package.yaml
@@ -2,6 +2,9 @@
This is the main module which provides the CLI
-}

-- Necessary to print git hash in help output
{-# LANGUAGE TemplateHaskell #-}

module Main where

import Protolude
@@ -16,6 +19,7 @@ import Data.Text.Prettyprint.Doc.Render.Terminal
import Data.Version (showVersion)
import Data.Yaml (decodeFileEither, prettyPrintParseException)
import GHC.IO.Encoding (setLocaleEncoding, utf8)
import GitHash
import Options.Applicative
import Paths_tasklite_core
import System.Directory
@@ -614,16 +618,23 @@ commandParser conf =

commandParserInfo :: Config -> ParserInfo Command
commandParserInfo conf =
info
(helper <*> commandParser conf)
(noIntersperse
<> briefDesc
<> headerDoc (Just "{{header}}")
<> progDescDoc (Just "{{examples}}")
<> footerDoc (Just $ fromString $
"Version " <> (showVersion version)
<> ", developed by <adriansieber.com> at <feram.io>\n")
)
let
gitInfo = $$tGitInfoCwd
versionString =
"Version "
<> (showVersion version)
<> "+" <> take 8 (giHash gitInfo)
<> (if giDirty gitInfo then "-dirty" else "")
<> ", developed by <adriansieber.com>\n"
in
info
(helper <*> commandParser conf)
(noIntersperse
<> briefDesc
<> headerDoc (Just "{{header}}")
<> progDescDoc (Just "{{examples}}")
<> footerDoc (Just $ fromString versionString)
)


groupBySpace :: Text -> [Doc ann]
@@ -33,6 +33,7 @@ dependencies:
- filepath
- fuzzy
- generic-random
- githash
- hourglass
- optparse-applicative
- prettyprinter

0 comments on commit 5f7b1ef

Please sign in to comment.
You can’t perform that action at this time.