-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rpc): extend search path, remove cd
- Loading branch information
Andrew Kent
committed
Mar 29, 2021
1 parent
b4e0a7f
commit 8e024a5
Showing
6 changed files
with
58 additions
and
54 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 was deleted.
Oops, something went wrong.
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,38 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
module CryptolServer.ExtendSearchPath | ||
( extSearchPath | ||
, extSearchPathDescr | ||
, ExtendSearchPathParams(..) | ||
) where | ||
|
||
|
||
import qualified Argo | ||
import qualified Argo.Doc as Doc | ||
import Data.Aeson as JSON ( (.:), withObject, FromJSON(parseJSON) ) | ||
|
||
import CryptolServer | ||
|
||
-- | Documentation for @extendSearchPath@ | ||
extSearchPathDescr :: Doc.Block | ||
extSearchPathDescr = | ||
Doc.Paragraph | ||
[Doc.Text "Extend the server's search path with the given paths."] | ||
|
||
-- | Extend the search path with the provided directories. | ||
extSearchPath :: ExtendSearchPathParams -> CryptolCommand () | ||
extSearchPath (ExtendSearchPathParams newDirs) = | ||
CryptolCommand $ const $ Argo.modifyState (extendSearchPath newDirs) | ||
|
||
data ExtendSearchPathParams | ||
= ExtendSearchPathParams [FilePath] | ||
|
||
instance FromJSON ExtendSearchPathParams where | ||
parseJSON = | ||
withObject "params for \"extend search path\"" $ | ||
\o -> ExtendSearchPathParams <$> o .: "paths" | ||
|
||
instance Doc.DescribedParams ExtendSearchPathParams where | ||
parameterFieldDescription = | ||
[("paths", | ||
Doc.Paragraph [Doc.Text "The paths to add to the search path."]) | ||
] |