diff --git a/app/ghcup/Main.hs b/app/ghcup/Main.hs index 4083923..23fb40b 100644 --- a/app/ghcup/Main.hs +++ b/app/ghcup/Main.hs @@ -138,6 +138,7 @@ data InstallOptions = InstallOptions , instPlatform :: Maybe PlatformRequest , instBindist :: Maybe URI , instSet :: Bool + , isolateDir :: Maybe FilePath } data SetCommand = SetGHC SetOptions @@ -574,7 +575,7 @@ Examples: installOpts :: Maybe Tool -> Parser InstallOptions installOpts tool = - (\p (u, v) b -> InstallOptions v p u b) + (\p (u, v) b is -> InstallOptions v p u b is) <$> optional (option (eitherReader platformParser) @@ -603,6 +604,15 @@ installOpts tool = (long "set" <> help "Set as active version after install" ) + <*> optional + (option + (eitherReader isolateParser) + ( short 'i' + <> long "isolate" + <> metavar "DIR" + <> help "install in an isolated dir instead of the default one" + ) + ) setParser :: Parser (Either SetCommand SetOptions) @@ -1215,6 +1225,10 @@ platformParser s' = case MP.parse (platformP <* MP.eof) "" (T.pack s') of bindistParser :: String -> Either String URI bindistParser = first show . parseURI strictURIParserOptions . UTF8.fromString +isolateParser :: FilePath -> Either String FilePath +isolateParser f = case isValid f of + True -> Right $ normalise f + False -> Left "Please enter a valid filepath for isolate dir." toSettings :: Options -> IO (Settings, KeyBindings) toSettings options = do