Commit a4e46349 authored by Duncan Coutts's avatar Duncan Coutts

Simplify the way we derive configure, install and upgrade commands

so we do not accidentally inherit the default flags for the underlying
configure command when we in fact want the empty flags. I am beginning
to suspect that having any defaults at all was a mistake.
parent 22b23f90
......@@ -62,11 +62,8 @@ globalCommand = Cabal.globalCommand {
++ "\nSee http://www.haskell.org/cabal/ for more information.\n"
}
cabalConfigureCommand :: CommandUI Cabal.ConfigFlags
cabalConfigureCommand = Cabal.configureCommand defaultProgramConfiguration
configureCommand :: CommandUI Cabal.ConfigFlags
configureCommand = cabalConfigureCommand {
configureCommand = (Cabal.configureCommand defaultProgramConfiguration) {
commandDefaultFlags = mempty
}
......@@ -91,14 +88,14 @@ updateCommand = CommandUI {
}
upgradeCommand :: CommandUI (Cabal.ConfigFlags, InstallFlags)
upgradeCommand = cabalConfigureCommand {
upgradeCommand = configureCommand {
commandName = "upgrade",
commandSynopsis = "Upgrades installed packages to the latest available version",
commandDescription = Nothing,
commandUsage = usagePackages "upgrade",
commandDefaultFlags = (mempty, defaultInstallFlags),
commandOptions = \showOrParseArgs ->
liftOptionsFst (commandOptions cabalConfigureCommand showOrParseArgs)
liftOptionsFst (commandOptions configureCommand showOrParseArgs)
++ liftOptionsSnd [optionDryRun]
}
......@@ -203,13 +200,13 @@ defaultInstallFlags = InstallFlags {
}
installCommand :: CommandUI (Cabal.ConfigFlags, InstallFlags)
installCommand = cabalConfigureCommand {
installCommand = configureCommand {
commandName = "install",
commandSynopsis = "Installs a list of packages.",
commandUsage = usagePackages "install",
commandDefaultFlags = (mempty, defaultInstallFlags),
commandOptions = \showOrParseArgs ->
liftOptionsFst (commandOptions cabalConfigureCommand showOrParseArgs)
liftOptionsFst (commandOptions configureCommand showOrParseArgs)
++ liftOptionsSnd
(optionDryRun : optionRootCmd :
case showOrParseArgs of -- TODO: remove when "cabal install" avoids
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment