-
-
Notifications
You must be signed in to change notification settings - Fork 22
[#67] Remove the cmd parameter from Tool, and cliEnvSettingsRequiredTools from CliEnvSettings
#97
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
[#67] Remove the cmd parameter from Tool, and cliEnvSettingsRequiredTools from CliEnvSettings
#97
Conversation
cmd parameter from Tool, and cliEnvSettingsRequiredTools
cmd parameter from Tool, and cliEnvSettingsRequiredToolscmd parameter from Tool, and cliEnvSettingsRequiredTools from CliEnvSettings
60ef1a3 to
4b33bbc
Compare
src/Iris/Tool.hs
Outdated
| __Throws:__ 'ToolCheckException' if can't find a tool or if it has wrong version. | ||
| @since 0.0.0.0 | ||
| -} | ||
| need :: [Tool] -> IO () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if this is the best signature for the need function. Maybe we should add a MonadIO m constraint? Let me know, please :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, let's actually have MonadIO m => constraint here. This function is supposed to be called from inside the custom monad, so having the MonadIO constraint allows us to do this easily without the need to call liftIO.
4b33bbc to
76c97a2
Compare
chshersh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @german1608 👋🏻
There's one minor change in the API of need but the rest of the PR looks great 🙂
Happy to merge the PR after making this change and rebasing on top of the latest main branch.
src/Iris/Tool.hs
Outdated
| __Throws:__ 'ToolCheckException' if can't find a tool or if it has wrong version. | ||
| @since 0.0.0.0 | ||
| -} | ||
| need :: [Tool] -> IO () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, let's actually have MonadIO m => constraint here. This function is supposed to be called from inside the custom monad, so having the MonadIO constraint allows us to do this easily without the need to call liftIO.
| it "should fail when 'need'ing not found tools" $ do | ||
| let tool = "xxx_unknown_executable" | ||
| let expectedExceptionSel (err :: ToolCheckException) = case err of | ||
| ToolCheckException (ToolNotFound e) -> e == tool | ||
| _other -> False | ||
|
|
||
| need [Tool tool Nothing] `shouldThrow` expectedExceptionSel | ||
|
|
||
| it "should fail when 'need'ing tools with wrong version" $ do | ||
|
|
||
| let expectedExceptionSel (err :: ToolCheckException) = case err of | ||
| ToolCheckException (ToolWrongVersion _) -> True | ||
| _other -> False | ||
| need [ghc100] `shouldThrow` expectedExceptionSel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding extra tests! 👏🏻
76c97a2 to
5e758c9
Compare
chshersh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
Co-authored-by: Dmitrii Kovanikov <[email protected]>
cmd parameter from Tool, and cliEnvSettingsRequiredTools from CliEnvSettingscmd parameter from Tool, and cliEnvSettingsRequiredTools from CliEnvSettings
Resolves #67
cmdparameter fromTool(and consequently,ToolSelector)needfunction, which does pretty much this: https://github.com/chshersh/iris/blob/main/src/Iris/Env.hs#L123-L126Additional tasks