[commit: Cabal] master: Exclude various fields from the config file (1536e13)

Ian Lynagh igloo at earth.li
Fri Jun 24 01:58:44 CEST 2011


Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/1536e139dbdbef6745bd10da2ce49dd001247140

>---------------------------------------------------------------

commit 1536e139dbdbef6745bd10da2ce49dd001247140
Author: Duncan Coutts <duncan at haskell.org>
Date:   Fri Aug 22 18:54:30 2008 +0000

    Exclude various fields from the config file
    Excluded fields that make sense as command line flags but do
    not make sense to use every time by saving in the config file.

>---------------------------------------------------------------

 cabal-install/Distribution/Client/Config.hs |   29 +++++++++++++++++++-------
 1 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/cabal-install/Distribution/Client/Config.hs b/cabal-install/Distribution/Client/Config.hs
index 16c0ce0..3e9fc2a 100644
--- a/cabal-install/Distribution/Client/Config.hs
+++ b/cabal-install/Distribution/Client/Config.hs
@@ -276,16 +276,29 @@ commentSavedConfig = do
 --
 configFieldDescriptions :: [FieldDescr SavedConfig]
 configFieldDescriptions =
-     toSavedConfig liftGlobalFlag  (commandOptions globalCommand ParseArgs)
-  ++ toSavedConfig liftInstallFlag (installOptions ParseArgs)
-  ++ noInstallDirs
-    (toSavedConfig liftConfigFlag  (configureOptions ParseArgs))
-  ++ toSavedConfig liftUploadFlag  (commandOptions uploadCommand ParseArgs)
+
+     toSavedConfig liftGlobalFlag
+       (commandOptions globalCommand ParseArgs)
+       ["version", "numeric-version", "config-file"]
+
+  ++ toSavedConfig liftInstallFlag
+       (installOptions ParseArgs)
+       ["dry-run", "reinstall", "only"]
+
+  ++ toSavedConfig liftConfigFlag
+       (configureOptions ParseArgs)
+       (["scratchdir", "configure-option"] ++ map fieldName installDirsFields)
+
+  ++ toSavedConfig liftUploadFlag
+       (commandOptions uploadCommand ParseArgs)
+       ["verbose", "check"]
 
   where
-    toSavedConfig lift = map (lift . viewAsFieldDescr)
-    noInstallDirs = filter ((`notElem` installDirFieldNames) . fieldName)
-    installDirFieldNames = map fieldName installDirsFields
+    toSavedConfig lift options excluded =
+      [ lift field
+      | opt <- options
+      , let field = viewAsFieldDescr opt
+      , fieldName field `notElem` excluded ]
 
 -- TODO: next step, make the deprecated fields elicit a warning.
 --





More information about the Cvs-libraries mailing list