Adds basic implementation of rmTool function

This commit is contained in:
Arjun Kathuria 2021-06-22 14:29:26 +05:30
parent 0f6381e67b
commit ec29332657
2 changed files with 38 additions and 1 deletions

View File

@ -1702,7 +1702,10 @@ Make sure to clean up #{tmpdir} afterwards.|])
else putStrLn uri' >> pure ExitSuccess
Nuke -> do
putStrLn "Nuking in 3...2....1"
putStrLn "Initiating Nuclear Sequence... "
lInstalled <- runLogger . flip runReaderT appstate $ listVersions Nothing (Just ListInstalled)
forM_ lInstalled $ runLogger . flip runReaderT appstate . rmTool
putStrLn "Nuking in 3...2...1"
putStrLn "BOOM!"
pure ExitSuccess

View File

@ -1282,6 +1282,40 @@ rmStackVer ver = do
Nothing -> liftIO $ rmLink (binDir </> "stack" <> exeExt)
rmTool :: ( MonadReader AppState m
, MonadLogger m
, MonadFail m
, MonadMask m
, MonadUnliftIO m)
=> ListResult
-> m ()
rmTool tool = do
let ListResult {lVer, lTool, lCross} = tool
-- appstate <- ask
case lTool of
GHC -> do
let ghcTargetVersion = GHCTargetVersion lCross lVer
_ <- runE @'[NotInstalled] $ rmGHCVer ghcTargetVersion
pure ()
HLS -> do
_ <- runE @'[NotInstalled] $ rmHLSVer lVer
pure ()
Cabal -> do
_ <- runE @'[NotInstalled] $ rmCabalVer lVer
pure ()
Stack -> do
_ <- runE @'[NotInstalled] $ rmStackVer lVer
pure ()
GHCup -> do
-- leaving this unimplemented for now.
pure ()
------------------
--[ Debug info ]--