[commit: packages/Cabal] ghc-head: Added an --all option for Haddock and hscolour. (f91f899)

git at git.haskell.org git at git.haskell.org
Mon Aug 26 23:27:29 CEST 2013


Repository : ssh://git@git.haskell.org/Cabal

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/Cabal.git;a=commit;h=f91f899899a0eb87173ce6b82ca657b72c5c4c0c

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

commit f91f899899a0eb87173ce6b82ca657b72c5c4c0c
Author: Jookia <166291 at gmail.com>
Date:   Mon Jun 10 20:54:00 2013 +1000

    Added an --all option for Haddock and hscolour.


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

f91f899899a0eb87173ce6b82ca657b72c5c4c0c
 Cabal/Distribution/Simple/Setup.hs |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/Cabal/Distribution/Simple/Setup.hs b/Cabal/Distribution/Simple/Setup.hs
index 442920a..1880d13 100644
--- a/Cabal/Distribution/Simple/Setup.hs
+++ b/Cabal/Distribution/Simple/Setup.hs
@@ -194,6 +194,9 @@ flagToList :: Flag a -> [a]
 flagToList (Flag x) = [x]
 flagToList NoFlag   = []
 
+allFlags :: [Flag Bool] -> Flag Bool
+allFlags flags = toFlag $ all (\f -> fromFlagOrDefault False f) flags
+
 -- ------------------------------------------------------------
 -- * Global flags
 -- ------------------------------------------------------------
@@ -1053,6 +1056,16 @@ hscolourCommand = makeCommand name shortDesc longDesc
          hscolourBenchmarks (\v flags -> flags { hscolourBenchmarks = v })
          trueArg
 
+      ,option "" ["all"]
+         "Run hscolour for all targets"
+         (\f -> allFlags [ hscolourExecutables f
+                         , hscolourTestSuites  f
+                         , hscolourBenchmarks  f])
+         (\v flags -> flags { hscolourExecutables = v
+                            , hscolourTestSuites  = v
+                            , hscolourBenchmarks  = v })
+         trueArg
+
       ,option "" ["css"]
          "Use a cascading style sheet"
          hscolourCSS (\v flags -> flags { hscolourCSS = v })
@@ -1151,6 +1164,16 @@ haddockCommand = makeCommand name shortDesc longDesc defaultHaddockFlags options
          haddockBenchmarks (\v flags -> flags { haddockBenchmarks = v })
          trueArg
 
+      ,option "" ["all"]
+         "Run haddock for all targets"
+         (\f -> allFlags [ haddockExecutables f
+                         , haddockTestSuites  f
+                         , haddockBenchmarks  f])
+         (\v flags -> flags { haddockExecutables = v
+                            , haddockTestSuites  = v
+                            , haddockBenchmarks  = v })
+         trueArg
+
       ,option "" ["internal"]
          "Run haddock for internal modules and include all symbols"
          haddockInternal (\v flags -> flags { haddockInternal = v })





More information about the ghc-commits mailing list