Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal On branch : master
http://hackage.haskell.org/trac/ghc/changeset/8de4b97f39ccb23c1172379c7fc9b0e613f666b5 >--------------------------------------------------------------- commit 8de4b97f39ccb23c1172379c7fc9b0e613f666b5 Author: Duncan Coutts <[email protected]> Date: Wed Jul 30 12:55:55 2008 +0000 Move the install command options so they're not toplevel decls Except for optionDryRun which is shared with another command. >--------------------------------------------------------------- cabal-install/Distribution/Client/Setup.hs | 67 ++++++++++++---------------- 1 files changed, 29 insertions(+), 38 deletions(-) diff --git a/cabal-install/Distribution/Client/Setup.hs b/cabal-install/Distribution/Client/Setup.hs index 0951d01..64aadf6 100644 --- a/cabal-install/Distribution/Client/Setup.hs +++ b/cabal-install/Distribution/Client/Setup.hs @@ -219,20 +219,35 @@ defaultInstallFlags = InstallFlags { installCommand :: CommandUI (Cabal.ConfigFlags, InstallFlags) installCommand = configureCommand { - commandName = "install", - commandSynopsis = "Installs a list of packages.", - commandUsage = usagePackages "install", - commandDefaultFlags = (mempty, defaultInstallFlags), - commandOptions = \showOrParseArgs -> - liftOptionsFst (commandOptions configureCommand showOrParseArgs) - ++ liftOptionsSnd - (optionDryRun - :optionRootCmd - :optionCabalVersion - :case showOrParseArgs of -- TODO: remove when "cabal install" avoids - ParseArgs -> [optionOnly] -- reconfiguring/building with dep. analysis - _ -> []) -- It's used by --root-cmd. - + commandName = "install", + commandSynopsis = "Installs a list of packages.", + commandUsage = usagePackages "install", + commandDefaultFlags = (mempty, defaultInstallFlags), + commandOptions = \showOrParseArgs -> + liftOptionsFst (commandOptions configureCommand showOrParseArgs) ++ + liftOptionsSnd + ([ optionDryRun + + , option [] ["root-cmd"] + "Command used to gain root privileges, when installing with --global." + installRootCmd (\v flags -> flags { installRootCmd = v }) + (reqArg' "COMMAND" toFlag flagToList) + + , option [] ["cabal-lib-version"] + ("Select which version of the Cabal lib to use to build packages " + ++ "(useful for testing).") + installCabalVersion (\v flags -> flags { installCabalVersion = v }) + (reqArg "VERSION" (readP_to_E ("Cannot parse cabal lib version: "++) + (fmap toFlag parse)) + (map display . flagToList)) + ] ++ case showOrParseArgs of -- TODO: remove when "cabal install" avoids + ParseArgs -> + option [] ["only"] + "Only installs the package in the current directory." + installOnly (\v flags -> flags { installOnly = v }) + trueArg + : [] + _ -> []) } optionDryRun :: OptionField InstallFlags @@ -242,30 +257,6 @@ optionDryRun = installDryRun (\v flags -> flags { installDryRun = v }) trueArg -optionOnly :: OptionField InstallFlags -optionOnly = - option [] ["only"] - "Only installs the package in the current directory." - installOnly (\v flags -> flags { installOnly = v }) - trueArg - -optionRootCmd :: OptionField InstallFlags -optionRootCmd = - option [] ["root-cmd"] - "Command used to gain root privileges, when installing with --global." - installRootCmd (\v flags -> flags { installRootCmd = v }) - (reqArg' "COMMAND" toFlag flagToList) - -optionCabalVersion :: OptionField InstallFlags -optionCabalVersion = - option [] ["cabal-lib-version"] - ("Select which version of the Cabal lib to use to build packages " - ++ "(useful for testing).") - installCabalVersion (\v flags -> flags { installCabalVersion = v }) - (reqArg "VERSION" (readP_to_E ("Cannot parse cabal lib version: "++) - (fmap toFlag parse)) - (map display . flagToList)) - instance Monoid InstallFlags where mempty = defaultInstallFlags mappend a b = InstallFlags { _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
