Move platform faking option into install subcommand

This commit is contained in:
Julian Ospald 2020-03-17 22:43:00 +01:00
parent f8448cf02b
commit fee16758de
1 changed files with 19 additions and 17 deletions

View File

@ -63,7 +63,6 @@ data Options = Options
, optCache :: Bool , optCache :: Bool
, optUrlSource :: Maybe URI , optUrlSource :: Maybe URI
, optNoVerify :: Bool , optNoVerify :: Bool
, optPlatform :: Maybe PlatformRequest
-- commands -- commands
, optCommand :: Command , optCommand :: Command
} }
@ -86,7 +85,8 @@ data InstallCommand = InstallGHC InstallOptions
| InstallCabal InstallOptions | InstallCabal InstallOptions
data InstallOptions = InstallOptions data InstallOptions = InstallOptions
{ instVer :: Maybe ToolVersion { instVer :: Maybe ToolVersion
, instPlatform :: Maybe PlatformRequest
} }
data SetGHCOptions = SetGHCOptions data SetGHCOptions = SetGHCOptions
@ -146,18 +146,6 @@ opts =
(short 'n' <> long "no-verify" <> help (short 'n' <> long "no-verify" <> help
"Skip tarball checksum verification (default: False)" "Skip tarball checksum verification (default: False)"
) )
<*> (optional
(option
(eitherReader platformParser)
( short 'p'
<> long "platform"
<> metavar "PLATFORM"
<> help
"Override for platform (triple matching ghc tarball names), e.g. x86_64-fedora27-linux"
<> internal
)
)
)
<*> com <*> com
where where
parseUri s' = parseUri s' =
@ -248,7 +236,21 @@ installP = subparser
) )
installOpts :: Parser InstallOptions installOpts :: Parser InstallOptions
installOpts = InstallOptions <$> optional toolVersionParser installOpts =
InstallOptions
<$> optional toolVersionParser
<*> (optional
(option
(eitherReader platformParser)
( short 'p'
<> long "platform"
<> metavar "PLATFORM"
<> help
"Override for platform (triple matching ghc tarball names), e.g. x86_64-fedora27-linux"
)
)
)
setGHCOpts :: Parser SetGHCOptions setGHCOpts :: Parser SetGHCOptions
setGHCOpts = SetGHCOptions <$> optional toolVersionParser setGHCOpts = SetGHCOptions <$> optional toolVersionParser
@ -612,7 +614,7 @@ main = do
void void
$ (runInstTool $ do $ (runInstTool $ do
v <- liftE $ fromVersion dls instVer GHC v <- liftE $ fromVersion dls instVer GHC
liftE $ installGHCBin dls v optPlatform liftE $ installGHCBin dls v instPlatform
) )
>>= \case >>= \case
VRight _ -> runLogger VRight _ -> runLogger
@ -635,7 +637,7 @@ Check the logs at ~/.ghcup/logs and the build directory #{tmpdir} for more clues
void void
$ (runInstTool $ do $ (runInstTool $ do
v <- liftE $ fromVersion dls instVer Cabal v <- liftE $ fromVersion dls instVer Cabal
liftE $ installCabalBin dls v optPlatform liftE $ installCabalBin dls v instPlatform
) )
>>= \case >>= \case
VRight _ -> runLogger VRight _ -> runLogger