Document and handle '--force' option better

This commit is contained in:
Julian Ospald 2022-05-12 13:28:09 +02:00
parent 10e704cd73
commit dc0ea5a59c
Signed by: hasufell
GPG Key ID: 3786C5262ECB4A3F
2 changed files with 11 additions and 11 deletions

View File

@ -99,7 +99,7 @@ data HLSCompileOptions = HLSCompileOptions
--[ Parsers ]-- --[ Parsers ]--
--------------- ---------------
compileP :: Parser CompileCommand compileP :: Parser CompileCommand
compileP = subparser compileP = subparser
( command ( command
@ -541,11 +541,11 @@ compile compileCommand settings Dirs{..} runAppState runLogger = do
pure ExitSuccess pure ExitSuccess
VLeft (V (AlreadyInstalled _ v)) -> do VLeft (V (AlreadyInstalled _ v)) -> do
runLogger $ logWarn $ runLogger $ logWarn $
"GHC ver " <> prettyVer v <> " already installed; if you really want to reinstall it, you may want to run 'ghcup install ghc --force " <> prettyVer v <> "'" "GHC ver " <> prettyVer v <> " already installed, remove it first to reinstall"
pure ExitSuccess pure ExitSuccess
VLeft (V (DirNotEmpty fp)) -> do VLeft (V (DirNotEmpty fp)) -> do
runLogger $ logWarn $ runLogger $ logError $
"Install directory " <> T.pack fp <> " is not empty. Use 'ghcup install ghc --isolate " <> T.pack fp <> " --force ..." <> "' to install regardless." "Install directory " <> T.pack fp <> " is not empty."
pure $ ExitFailure 3 pure $ ExitFailure 3
VLeft err@(V (BuildFailed tmpdir _)) -> do VLeft err@(V (BuildFailed tmpdir _)) -> do
case keepDirs settings of case keepDirs settings of

View File

@ -210,7 +210,7 @@ installOpts tool =
) )
) )
<*> switch <*> switch
(short 'f' <> long "force" <> help "Force install") (short 'f' <> long "force" <> help "Force install (THIS IS UNSAFE, only use it in Dockerfiles or CI)")
where where
setDefault = case tool of setDefault = case tool of
Nothing -> False Nothing -> False
@ -421,20 +421,20 @@ install installCommand settings getAppState' runLogger = case installCommand of
VLeft (V (AlreadyInstalled _ v, ())) -> do VLeft (V (AlreadyInstalled _ v, ())) -> do
runLogger $ logWarn $ runLogger $ logWarn $
"GHC ver " <> prettyVer v <> " already installed; if you really want to reinstall it, you may want to run 'ghcup install ghc --force " <> prettyVer v <> "'" "GHC ver " <> prettyVer v <> " already installed, remove it first to reinstall"
pure ExitSuccess pure ExitSuccess
VLeft (V (AlreadyInstalled _ v)) -> do VLeft (V (AlreadyInstalled _ v)) -> do
runLogger $ logWarn $ runLogger $ logWarn $
"GHC ver " <> prettyVer v <> " already installed; if you really want to reinstall it, you may want to run 'ghcup install ghc --force " <> prettyVer v <> "'" "GHC ver " <> prettyVer v <> " already installed, remove it first to reinstall"
pure ExitSuccess pure ExitSuccess
VLeft (V (DirNotEmpty fp)) -> do VLeft (V (DirNotEmpty fp)) -> do
runLogger $ logWarn $ runLogger $ logError $
"Install directory " <> T.pack fp <> " is not empty. Use 'ghcup install ghc --isolate " <> T.pack fp <> " --force ..." <> "' to install regardless." "Install directory " <> T.pack fp <> " is not empty."
pure $ ExitFailure 3 pure $ ExitFailure 3
VLeft (V (DirNotEmpty fp, ())) -> do VLeft (V (DirNotEmpty fp, ())) -> do
runLogger $ logWarn $ runLogger $ logError $
"Install directory " <> T.pack fp <> " is not empty. Use 'ghcup install ghc --isolate " <> T.pack fp <> " --force ..." <> "' to install regardless." "Install directory " <> T.pack fp <> " is not empty."
pure $ ExitFailure 3 pure $ ExitFailure 3
VLeft err@(V (BuildFailed tmpdir _)) -> do VLeft err@(V (BuildFailed tmpdir _)) -> do