Add “Ignore warning” option to cabal check
[cabal.git] / cabal-install / src / Distribution / Client / ManpageFlags.hs
blobba76e314af281140c461fec1722fbf7bb031c8be
1 {-# LANGUAGE DeriveGeneric #-}
2 {-# LANGUAGE LambdaCase #-}
4 module Distribution.Client.ManpageFlags
5 ( ManpageFlags (..)
6 , defaultManpageFlags
7 , manpageOptions
8 ) where
10 import Distribution.Client.Compat.Prelude
12 import Distribution.Simple.Command (OptionField (..), ShowOrParseArgs (..), option)
13 import Distribution.Simple.Setup (Flag (..), optionVerbosity, toFlag, trueArg)
14 import Distribution.Verbosity (normal)
16 data ManpageFlags = ManpageFlags
17 { manpageVerbosity :: Flag Verbosity
18 , manpageRaw :: Flag Bool
20 deriving (Eq, Show, Generic)
22 instance Monoid ManpageFlags where
23 mempty = gmempty
24 mappend = (<>)
26 instance Semigroup ManpageFlags where
27 (<>) = gmappend
29 defaultManpageFlags :: ManpageFlags
30 defaultManpageFlags =
31 ManpageFlags
32 { manpageVerbosity = toFlag normal
33 , manpageRaw = toFlag False
36 manpageOptions :: ShowOrParseArgs -> [OptionField ManpageFlags]
37 manpageOptions _ =
38 [ optionVerbosity manpageVerbosity (\v flags -> flags{manpageVerbosity = v})
39 , option
41 ["raw"]
42 "Output raw troff content"
43 manpageRaw
44 (\v flags -> flags{manpageRaw = v})
45 trueArg