Skip to content

Commit 0c292d1

Browse files
committed
Also display full version slug with tl version
1 parent b08b09e commit 0c292d1

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

tasklite-core/app/Main.hs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,18 @@ nameToAliasList = (
162162
[])
163163

164164

165+
{- Imitates output from `git describe` -}
166+
versionSlug :: Text
167+
versionSlug =
168+
let
169+
gitInfo = $$tGitInfoCwd
170+
in
171+
fromString $
172+
(showVersion version)
173+
<> "+" <> take 8 (giHash gitInfo)
174+
<> (if giDirty gitInfo then "-dirty" else "")
175+
176+
165177
aliasWarning :: Text -> Doc AnsiStyle
166178
aliasWarning alias =
167179
"Invalid command."
@@ -620,21 +632,18 @@ commandParser conf =
620632
commandParserInfo :: Config -> ParserInfo Command
621633
commandParserInfo conf =
622634
let
623-
gitInfo = $$tGitInfoCwd
624-
versionString =
635+
versionDesc =
625636
"Version "
626-
<> (showVersion version)
627-
<> "+" <> take 8 (giHash gitInfo)
628-
<> (if giDirty gitInfo then "-dirty" else "")
629-
<> ", developed by <adriansieber.com>\n"
637+
<> versionSlug
638+
<> ", developed by <adriansieber.com>"
630639
in
631640
info
632641
(helper <*> commandParser conf)
633642
(noIntersperse
634643
<> briefDesc
635644
<> headerDoc (Just "{{header}}")
636645
<> progDescDoc (Just "{{examples}}")
637-
<> footerDoc (Just $ fromString versionString)
646+
<> footerDoc (Just $ fromString $ T.unpack versionDesc)
638647
)
639648

640649

@@ -800,7 +809,7 @@ executeCLiCommand conf now connection cmd =
800809
{- Unset -}
801810
UnDueTasks ids -> undueTasks conf connection ids
802811

803-
Version -> pure $ pretty (showVersion version) <> hardline
812+
Version -> pure $ pretty versionSlug <> hardline
804813
Help -> pure $ helpText conf
805814
PrintConfig -> pure $ pretty conf
806815
Alias alias -> pure $ aliasWarning alias

0 commit comments

Comments
 (0)