2 {-# LANGUAGE DeriveDataTypeable #-}
3 {-# LANGUAGE DeriveGeneric #-}
4 {-# LANGUAGE FlexibleContexts #-}
5 {-# LANGUAGE RankNTypes #-}
7 -----------------------------------------------------------------------------
10 -- Module : Distribution.Simple.Setup.Hscolour
11 -- Copyright : Isaac Jones 2003-2004
15 -- Maintainer : cabal-devel@haskell.org
16 -- Portability : portable
18 -- Definition of the hscolour command-line options.
19 -- See: @Distribution.Simple.Setup@
20 module Distribution
.Simple
.Setup
.Hscolour
23 , defaultHscolourFlags
27 import Distribution
.Compat
.Prelude
hiding (get
)
30 import Distribution
.Simple
.Command
hiding (boolOpt
, boolOpt
')
31 import Distribution
.Simple
.Flag
32 import Distribution
.Verbosity
34 import Distribution
.Simple
.Setup
.Common
36 -- ------------------------------------------------------------
40 -- ------------------------------------------------------------
42 data HscolourFlags
= HscolourFlags
43 { hscolourCSS
:: Flag
FilePath
44 , hscolourExecutables
:: Flag
Bool
45 , hscolourTestSuites
:: Flag
Bool
46 , hscolourBenchmarks
:: Flag
Bool
47 , hscolourForeignLibs
:: Flag
Bool
48 , hscolourDistPref
:: Flag
FilePath
49 , hscolourVerbosity
:: Flag Verbosity
50 , hscolourCabalFilePath
:: Flag
FilePath
52 deriving (Show, Generic
, Typeable
)
54 emptyHscolourFlags
:: HscolourFlags
55 emptyHscolourFlags
= mempty
57 defaultHscolourFlags
:: HscolourFlags
58 defaultHscolourFlags
=
60 { hscolourCSS
= NoFlag
61 , hscolourExecutables
= Flag
False
62 , hscolourTestSuites
= Flag
False
63 , hscolourBenchmarks
= Flag
False
64 , hscolourDistPref
= NoFlag
65 , hscolourForeignLibs
= Flag
False
66 , hscolourVerbosity
= Flag normal
67 , hscolourCabalFilePath
= mempty
70 instance Monoid HscolourFlags
where
74 instance Semigroup HscolourFlags
where
77 hscolourCommand
:: CommandUI HscolourFlags
80 { commandName
= "hscolour"
82 "Generate HsColour colourised code, in HTML format."
83 , commandDescription
= Just
(\_
-> "Requires the hscolour program.\n")
84 , commandNotes
= Just
$ \_
->
85 "Deprecated in favour of 'cabal haddock --hyperlink-source'."
86 , commandUsage
= \pname
->
87 "Usage: " ++ pname
++ " hscolour [FLAGS]\n"
88 , commandDefaultFlags
= defaultHscolourFlags
89 , commandOptions
= \showOrParseArgs
->
92 (\v flags
-> flags
{hscolourVerbosity
= v
})
95 (\d flags
-> flags
{hscolourDistPref
= d
})
100 "Run hscolour for Executables targets"
102 (\v flags
-> flags
{hscolourExecutables
= v
})
107 "Run hscolour for Test Suite targets"
109 (\v flags
-> flags
{hscolourTestSuites
= v
})
114 "Run hscolour for Benchmark targets"
116 (\v flags
-> flags
{hscolourBenchmarks
= v
})
120 ["foreign-libraries"]
121 "Run hscolour for Foreign Library targets"
123 (\v flags
-> flags
{hscolourForeignLibs
= v
})
128 "Run hscolour for all targets"
131 [ hscolourExecutables f
132 , hscolourTestSuites f
133 , hscolourBenchmarks f
134 , hscolourForeignLibs f
139 { hscolourExecutables
= v
140 , hscolourTestSuites
= v
141 , hscolourBenchmarks
= v
142 , hscolourForeignLibs
= v
149 "Use a cascading style sheet"
151 (\v flags
-> flags
{hscolourCSS
= v
})