Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#329] Add GHC version to the --version output #330

Merged
merged 2 commits into from
Jun 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ The change log is available [on GitHub][2].
* [#327](https://github.com/kowainik/stan/issues/327):
When the generated HIE files are incomplete (missing the source code),
print `<UNAVAILABLE>` as the source instead of failing.
* [#329](https://github.com/kowainik/stan/issues/329):
Add GHC version to the `--version` output.

## 0.0.0.0

Expand Down
4 changes: 2 additions & 2 deletions src/Stan/Cli.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import Stan.Category (Category (..))
import Stan.Config (Check (..), CheckFilter (..), CheckType (..), ConfigP (..), PartialConfig,
Scope (..))
import Stan.Core.Id (Id (..))
import Stan.Info (prettyStanVersion, stanVersion)
import Stan.Info (prettyStanVersion, stanVersion, stanSystem)
import Stan.Inspection (Inspection)
import Stan.Observation (Observation)
import Stan.Report.Settings (ReportSettings (..), ToggleSolution (..), Verbosity (..))
Expand Down Expand Up @@ -317,7 +317,7 @@ scopeP =

-- | Show the version of the tool.
versionP :: Parser (a -> a)
versionP = infoOption (prettyStanVersion stanVersion)
versionP = infoOption (prettyStanVersion stanVersion stanSystem)
$ long "version"
<> short 'v'
<> help "Show Stan's version"
Expand Down
6 changes: 4 additions & 2 deletions src/Stan/Info.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ stanVersion = StanVersion

{- | Colourful pretty 'StanVersion' representation used in the @CLI@.
-}
prettyStanVersion :: StanVersion -> String
prettyStanVersion StanVersion{..} = toString $ intercalate "\n"
prettyStanVersion :: StanVersion -> StanSystem -> String
prettyStanVersion StanVersion{..} StanSystem{..} = toString $ intercalate "\n"
[ sVersion
, sHash
, sDate
, sGhc
]
where
fmt :: String -> String
Expand All @@ -65,6 +66,7 @@ prettyStanVersion StanVersion{..} = toString $ intercalate "\n"
sVersion = fmt $ "Stan " <> "v" <> svVersion
sHash = " ➤ " <> fmt "Git revision: " <> svGitRevision
sDate = " ➤ " <> fmt "Commit date: " <> svCommitDate
sGhc = " ➤ " <> fmt "GHC version: " <> ssCompilerVersion

{- | Contains all @stan@ System information
-}
Expand Down