-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1547 from GaloisInc/version-python-cmd
Add `version` command to cryptol-remote-api
- Loading branch information
Showing
12 changed files
with
200 additions
and
6 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
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
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
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,60 @@ | ||
{-# LANGUAGE MultiParamTypeClasses #-} | ||
{-# LANGUAGE OverloadedStrings #-} | ||
module CryptolServer.Version | ||
( version | ||
, versionDescr | ||
, VersionParams(..) | ||
) where | ||
|
||
import qualified Argo.Doc as Doc | ||
import Data.Aeson as JSON | ||
|
||
import qualified Paths_cryptol_remote_api as RPC | ||
import qualified Cryptol.Version as Cry | ||
import Data.Version (showVersion) | ||
|
||
import CryptolServer | ||
|
||
versionDescr :: Doc.Block | ||
versionDescr = | ||
Doc.Paragraph | ||
[Doc.Text "Version information about this Cryptol server."] | ||
|
||
version :: VersionParams -> CryptolCommand JSON.Value | ||
version _ = | ||
return $ JSON.object [ "RPC server version" .= showVersion RPC.version | ||
, "version" .= showVersion Cry.version | ||
, "commit hash" .= Cry.commitHash | ||
, "commit branch" .= Cry.commitBranch | ||
, "commit dirty" .= Cry.commitDirty | ||
, "FFI enabled" .= Cry.ffiEnabled | ||
] | ||
|
||
data VersionParams = VersionParams | ||
|
||
instance JSON.FromJSON VersionParams where | ||
parseJSON _ = pure VersionParams | ||
|
||
instance Doc.DescribedMethod VersionParams JSON.Value where | ||
parameterFieldDescription = [] | ||
|
||
resultFieldDescription = | ||
[ ("RPC server version", | ||
Doc.Paragraph [ Doc.Text "The cryptol-remote-api version string." | ||
]) | ||
, ("version", | ||
Doc.Paragraph [ Doc.Text "The Cryptol version string." | ||
]) | ||
, ("commit hash", | ||
Doc.Paragraph [ Doc.Text "The string of the git commit hash during the build of Cryptol." | ||
]) | ||
, ("commit branch", | ||
Doc.Paragraph [ Doc.Text "The string of the git commit branch during the build of Cryptol." | ||
]) | ||
, ("commit dirty", | ||
Doc.Paragraph [ Doc.Text "True iff non-committed files were present during the build of Cryptol." | ||
]) | ||
, ("FFI enabled", | ||
Doc.Paragraph [ Doc.Text "True iff the FFI is enabled." | ||
]) | ||
] |
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