From eded057d3b07541193d53ee525de55b5a010965a Mon Sep 17 00:00:00 2001 From: Duncan Coutts Date: Sat, 19 Jan 2008 17:03:58 +0000 Subject: [PATCH] Make the configure command take the defaults from the config file Just like the install command has always done. This makes them consistent. So by default that means cabal configure uses --user --prefix=$HOME/.cabal --- Hackage/Setup.hs | 6 ++++++ Main.hs | 15 +++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Hackage/Setup.hs b/Hackage/Setup.hs index 8548fdef81f..7d12ddd8c72 100644 --- a/Hackage/Setup.hs +++ b/Hackage/Setup.hs @@ -12,6 +12,7 @@ ----------------------------------------------------------------------------- module Hackage.Setup ( globalCommand, Cabal.GlobalFlags(..) + , configureCommand , installCommand --Cabal.InstallFlags(..) , listCommand , updateCommand @@ -61,6 +62,11 @@ globalCommand = Cabal.globalCommand { ++ "\nSee http://www.haskell.org/cabal/ for more information.\n" } +configureCommand :: CommandUI Cabal.ConfigFlags +configureCommand = (Cabal.configureCommand defaultProgramConfiguration) { + commandDefaultFlags = mempty + } + installCommand :: CommandUI Cabal.ConfigFlags installCommand = (Cabal.configureCommand defaultProgramConfiguration) { commandName = "install", diff --git a/Main.hs b/Main.hs index b1231058dcd..583679571bb 100644 --- a/Main.hs +++ b/Main.hs @@ -78,7 +78,8 @@ mainWorker args = ++ " of the Cabal library " commands = - [installCommand `commandAddAction` installAction + [configureCommand `commandAddAction` configureAction + ,installCommand `commandAddAction` installAction ,infoCommand `commandAddAction` infoAction ,listCommand `commandAddAction` listAction ,updateCommand `commandAddAction` updateAction @@ -86,7 +87,6 @@ mainWorker args = ,fetchCommand `commandAddAction` fetchAction ,uploadCommand `commandAddAction` uploadAction - ,wrapperAction (Cabal.configureCommand defaultProgramConfiguration) ,wrapperAction (Cabal.buildCommand defaultProgramConfiguration) ,wrapperAction Cabal.copyCommand ,wrapperAction Cabal.haddockCommand @@ -106,6 +106,17 @@ wrapperAction command = let args = commandName command : commandShowOptions command flags ++ extraArgs in setupWrapper args Nothing +configureAction :: Cabal.ConfigFlags -> [String] -> IO () +configureAction flags extraArgs = do + configFile <- defaultConfigFile --FIXME + let verbosity = fromFlagOrDefault normal (Cabal.configVerbose flags) + config <- loadConfig verbosity configFile + let flags' = savedConfigToConfigFlags (Cabal.configPackageDB flags) config + `mappend` flags + args = commandName configureCommand + : commandShowOptions configureCommand flags' ++ extraArgs + setupWrapper args Nothing + installAction :: Cabal.ConfigFlags -> [String] -> IO () installAction flags extraArgs = do pkgs <- either die return (parsePackageArgs extraArgs)